コード例 #1
0
ファイル: test_sdist_check.py プロジェクト: ulif/sdist_check
 def test_create_command(self):
     # we can create an instance of sdist_check
     dist = Distribution({})
     cmd = sdist_check(dist)
     cmd.ensure_finalized()
     assert hasattr(cmd, "badfiles")
     assert cmd.badfiles == ["*~", ]
コード例 #2
0
ファイル: test_sdist_check.py プロジェクト: ulif/sdist_check
 def test_badfiles_option_must_hold_string_list(self):
     # we do not accept numbers for string lists in `badfiles`
     cmd = sdist_check(Distribution({}))
     cmd.badfiles = 42
     with pytest.raises(DistutilsOptionError) as why:
         cmd.ensure_finalized()
     err_msg = why.value.args[0]
     assert err_msg == "'badfiles' must be a list of strings (got 42)"
コード例 #3
0
ファイル: test_sdist_check.py プロジェクト: ulif/sdist_check
 def test_get_sdist_filelist(self, sample_pkg):
     # we can get an sdist filelist
     dist = Distribution(SETUP_ATTRS)
     dist.script_name = "setup.py"
     cmd = sdist_check(dist)
     cmd.ensure_finalized()
     file_list = cmd._get_sdist_filelist()
     assert "sample_test/__init__.py" in file_list.files
     assert "setup.py" in file_list.files
コード例 #4
0
ファイル: test_sdist_check.py プロジェクト: ulif/sdist_check
 def test_check_bad_filenames_filename(self, sample_pkg, capsys):
     # we do not get any output if there are no bad filenames.
     dist = Distribution(SETUP_ATTRS)
     dist.script_name = "setup.py"
     sample_pkg.join("MANIFEST.in").write("graft sample_test\n")
     cmd = sdist_check(dist)
     cmd.ensure_finalized()
     cmd.check_bad_filenames()
     out, err = capsys.readouterr()
     assert err == ""
コード例 #5
0
ファイル: test_sdist_check.py プロジェクト: ulif/sdist_check
 def test_command_runnable(self, sample_pkg, capfd):
     # we can run() the new command
     sample_pkg.join("MANIFEST.in").write("graft sample_test\n")
     sample_pkg.join("sample_test").join("file~").write("foo")
     dist = Distribution(dict(SETUP_ATTRS))
     dist.script_name = "setup.py"
     cmd = sdist_check(dist)
     cmd.ensure_finalized()
     cmd.run()
     out, err = capfd.readouterr()
     assert (
         u'warning: sdist_check: suspicious filename found for '
         u'distribution: sample_test/file~\n\n') in err
コード例 #6
0
ファイル: test_sdist_check.py プロジェクト: ulif/sdist_check
 def test_check_bad_filenames_filename_tilde(self, sample_pkg, capsys):
     # we are warned about bad filenames like *~, which are listed
     # in the default list of bad filenames.
     dist = Distribution(SETUP_ATTRS)
     dist.script_name = "setup.py"
     sample_pkg.join("MANIFEST.in").write("graft sample_test\n")
     sample_pkg.join("sample_test").join("workfile~").write("foo")
     cmd = sdist_check(dist)
     cmd.ensure_finalized()
     cmd.check_bad_filenames()
     out, err = capsys.readouterr()
     assert "warning: sdist_check" in err
     assert "sample_test/workfile~" in err
コード例 #7
0
ファイル: test_sdist_check.py プロジェクト: ulif/sdist_check
 def test_check_bad_filenames_overriden(self, sample_pkg, capsys):
     # if we override the default "badfiles", we are not warned
     # about these files anymore (but about others).
     dist = Distribution(SETUP_ATTRS)
     dist.script_name = "setup.py"
     sample_pkg.join("MANIFEST.in").write("graft sample_test\n")
     sample_pkg.join("sample_test").join("file.foo").write("foo")
     sample_pkg.join("sample_test").join("file~").write("foo")
     cmd = sdist_check(dist)
     cmd.badfiles = ["*.foo", ]
     cmd.ensure_finalized()
     cmd.check_bad_filenames()
     out, err = capsys.readouterr()
     assert "warning: sdist_check" in err
     assert "sample_test/file.foo" in err
     assert "sample_test/file~" not in err
コード例 #8
0
ファイル: test_sdist_check.py プロジェクト: ulif/sdist_check
 def test_badfiles_option_strings_become_list_items(self):
     # regular strings given for `badfiles` option become a list
     cmd = sdist_check(Distribution({}))
     cmd.badfiles = "a-string"
     cmd.ensure_finalized()
     assert cmd.badfiles == ['a-string']
コード例 #9
0
ファイル: test_sdist_check.py プロジェクト: ulif/sdist_check
 def test_badfiles_option_strings_split_colon(self):
     # we do accept strings but split them by colons
     cmd = sdist_check(Distribution({}))
     cmd.badfiles = "a,string"
     cmd.ensure_finalized()
     assert cmd.badfiles == ['a', 'string']
コード例 #10
0
ファイル: test_sdist_check.py プロジェクト: ulif/sdist_check
 def test_badfiles_option_default(self):
     # we provide a sensible default for badfiles option
     cmd = sdist_check(Distribution({}))
     cmd.ensure_finalized()
     assert cmd.badfiles == ["*~", ]