def create_project(): project = Project("/") project.build_depends_on("testingframework") project.depends_on("sometool") project.depends_on( "pyassert", url="https://github.com/downloads/halimath/pyassert/pyassert-0.2.2.tar.gz") project.name = "Spam and Eggs" project.version = "1.2.3" project.summary = "This is a simple integration-test for distutils plugin." project.description = "As you might have guessed we have nothing to say here." project.authors = [ Author("Udo Juettner", "*****@*****.**"), Author("Michael Gruber", "*****@*****.**")] project.license = "WTFPL" project.url = "http://github.com/pybuilder/pybuilder" def return_dummy_list(): return ["spam", "eggs"] project.list_scripts = return_dummy_list project.list_packages = return_dummy_list project.list_modules = return_dummy_list project.set_property("distutils_classifiers", [ "Development Status :: 5 - Beta", "Environment :: Console"]) project.install_file("dir", "file1") project.install_file("dir", "file2") project.include_file("spam", "eggs") return project
def create_project(): project = Project("/") project.build_depends_on("testingframework") project.depends_on("sometool") project.depends_on( "pyassert", url= "https://github.com/downloads/halimath/pyassert/pyassert-0.2.2.tar.gz") project.name = "Spam and Eggs" project.version = "1.2.3" project.summary = "This is a simple integration-test for distutils plugin." project.description = "As you might have guessed we have nothing to say here." project.authors = [ Author("Udo Juettner", "*****@*****.**"), Author("Michael Gruber", "*****@*****.**") ] project.license = "WTFPL" project.url = "http://github.com/pybuilder/pybuilder" project.explicit_namespaces = ["foo.bar", "quick.brown.fox"] def return_dummy_list(): return ["spam", "eggs"] project.list_scripts = return_dummy_list project.list_packages = return_dummy_list project.list_modules = return_dummy_list project.set_property( "distutils_classifiers", ["Development Status :: 5 - Beta", "Environment :: Console"]) project.install_file("dir", "file1") project.install_file("dir", "file2") project.include_file("spam", "eggs") return project
class ProjectPackageDataTests(unittest.TestCase): def setUp(self): self.project = Project(basedir="/imaginary", name="Unittest") def test_should_raise_exception_when_package_name_not_given(self): self.assertRaises(ValueError, self.project.include_file, None, "spam") def test_should_raise_exception_when_filename_not_given(self): self.assertRaises( ValueError, self.project.include_file, "my_package", None) def test_should_raise_exception_when_package_name_is_empty_string(self): self.assertRaises( ValueError, self.project.include_file, " \n", "spam") def test_should_raise_exception_when_filename_is_empty_string(self): self.assertRaises( ValueError, self.project.include_file, "eggs", "\t \n") def test_should_raise_exception_when_package_path_not_given(self): self.assertRaises(ValueError, self.project.include_directory, None, "spam") def test_should_raise_exception_when_package_path_is_empty_string(self): self.assertRaises(ValueError, self.project.include_directory, "\t \n", "spam") def test_should_raise_exception_when_patterns_list_not_given(self): self.assertRaises(ValueError, self.project.include_directory, "spam", None) def test_should_raise_exception_when_patterns_list_is_empty_list(self): self.assertRaises(ValueError, self.project.include_directory, "spam", ["\t \n"]) def test_should_package_data_dictionary_is_empty(self): self.assertEquals({}, self.project.package_data) def test_should_add_filename_to_list_of_included_files_for_package_spam(self): self.project.include_file("spam", "eggs") self.assertEquals({"spam": ["eggs"]}, self.project.package_data) def test_should_add_two_filenames_to_list_of_included_files_for_package_spam(self): self.project.include_file("spam", "eggs") self.project.include_file("spam", "ham") self.assertEquals({"spam": ["eggs", "ham"]}, self.project.package_data) def test_should_add_two_filenames_to_list_of_included_files_for_two_different_packages(self): self.project.include_file("spam", "eggs") self.project.include_file("monty", "ham") self.assertEquals( {"monty": ["ham"], "spam": ["eggs"]}, self.project.package_data) def test_should_add_two_filenames_to_list_of_included_files_and_to_manifest(self): self.project.include_file("spam", "eggs") self.project.include_file("monty", "ham") self.assertEquals( {"monty": ["ham"], "spam": ["eggs"]}, self.project.package_data) self.assertEquals( ["spam/eggs", "monty/ham"], self.project.manifest_included_files)
def set_properties(project: Project): # Dependencies project.depends_on("kombu", "4.0.2") project.build_depends_on("sqlalchemy") project.build_depends_on("django") project.build_depends_on("karellen-sqlite", "~=0.0.0") project.build_depends_on("unittest2") # Cram Configuration project.set_property("cram_fail_if_no_tests", False) # Disable flake8 project.set_property("flake8_break_build", False) # Integration Tests Coverage is disabled since there are no integration tests project.set_property("unittest_coverage_threshold_warn", 0) project.set_property("unittest_coverage_branch_threshold_warn", 0) project.set_property("unittest_coverage_branch_partial_threshold_warn", 0) project.set_property("unittest_coverage_allow_non_imported_modules", True) project.set_property("integrationtest_coverage_threshold_warn", 0) project.set_property("integrationtest_coverage_branch_threshold_warn", 0) project.set_property( "integrationtest_coverage_branch_partial_threshold_warn", 0) project.set_property("integrationtest_coverage_allow_non_imported_modules", True) project.set_property("pybuilder_header_plugin_break_build", False) project.set_property("copy_resources_target", "$dir_dist/karellen") project.get_property("copy_resources_glob").append("LICENSE.bsd3") project.get_property("copy_resources_glob").append("LICENSE.apache") project.include_file("karellen", "LICENSE.bsd3") project.include_file("karellen", "LICENSE.apache") # Distutils project.set_property( "distutils_classifiers", project.get_property("distutils_classifiers") + [ 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Topic :: Software Development :: Libraries', 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Internet', ]) project.set_property("pdoc_module_name", "karellen.kombu")
def set_properties(project: Project): project.depends_on("pybuilder") project.set_property('flake8_break_build', True) project.set_property('flake8_include_test_sources', True) project.set_property('flake8_include_scripts', True) project.set_property('flake8_max_line_length', 130) project.set_property("copy_resources_target", "$dir_dist/pybuilder-pipenv") project.get_property("copy_resources_glob").append("LICENSE") project.include_file("pybuilder-pipenv", "LICENSE") project.set_property("distutils_classifiers", [ 'Programming Language :: Python', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'License :: OSI Approved :: GNU General Public License (GPL)', 'Topic :: Software Development :: Build Tools' ])
class BuildPackageDataStringTest(unittest.TestCase): def setUp(self): self.project = Project('.') def test_should_return_empty_package_data_string_when_no_files_to_include_given(self): self.assertEqual('{}', build_package_data_string(self.project)) def test_should_return_package_data_string_when_including_file(self): self.project.include_file("spam", "egg") self.assertEqual( "{\n" " 'spam': ['egg']\n" " }", build_package_data_string(self.project)) def test_should_return_package_data_string_when_including_three_files(self): self.project.include_file("spam", "egg") self.project.include_file("ham", "eggs") self.project.include_file("monty", "python") self.assertEqual("{\n" " 'ham': ['eggs'],\n" " 'monty': ['python'],\n" " 'spam': ['egg']\n" " }", build_package_data_string(self.project)) def test_should_return_package_data_string_with_keys_in_alphabetical_order(self): self.project.include_file("b", "beta") self.project.include_file("m", "Mu") self.project.include_file("e", "epsilon") self.project.include_file("k", "Kappa") self.project.include_file("p", "psi") self.project.include_file("z", "Zeta") self.project.include_file("i", "Iota") self.project.include_file("a", "alpha") self.project.include_file("d", "delta") self.project.include_file("t", "theta") self.project.include_file("l", "lambda") self.project.include_file("x", "chi") self.assertEqual("{\n" " 'a': ['alpha'],\n" " 'b': ['beta'],\n" " 'd': ['delta'],\n" " 'e': ['epsilon'],\n" " 'i': ['Iota'],\n" " 'k': ['Kappa'],\n" " 'l': ['lambda'],\n" " 'm': ['Mu'],\n" " 'p': ['psi'],\n" " 't': ['theta'],\n" " 'x': ['chi'],\n" " 'z': ['Zeta']\n" " }", build_package_data_string(self.project))
class BuildPackageDataStringTest(unittest.TestCase): def setUp(self): self.project = Project('.') def test_should_return_empty_package_data_string_when_no_files_to_include_given( self): self.assertEqual('{}', build_package_data_string(self.project)) def test_should_return_package_data_string_when_including_file(self): self.project.include_file("spam", "egg") self.assertEqual("{\n" " 'spam': ['egg']\n" " }", build_package_data_string(self.project)) def test_should_return_package_data_string_when_including_three_files( self): self.project.include_file("spam", "egg") self.project.include_file("ham", "eggs") self.project.include_file("monty", "python") self.assertEqual( "{\n" " 'ham': ['eggs'],\n" " 'monty': ['python'],\n" " 'spam': ['egg']\n" " }", build_package_data_string(self.project)) def test_should_return_package_data_string_with_keys_in_alphabetical_order( self): self.project.include_file("b", "beta") self.project.include_file("m", "Mu") self.project.include_file("e", "epsilon") self.project.include_file("k", "Kappa") self.project.include_file("p", "psi") self.project.include_file("z", "Zeta") self.project.include_file("i", "Iota") self.project.include_file("a", "alpha") self.project.include_file("d", "delta") self.project.include_file("t", "theta") self.project.include_file("l", "lambda") self.project.include_file("x", "chi") self.assertEqual( "{\n" " 'a': ['alpha'],\n" " 'b': ['beta'],\n" " 'd': ['delta'],\n" " 'e': ['epsilon'],\n" " 'i': ['Iota'],\n" " 'k': ['Kappa'],\n" " 'l': ['lambda'],\n" " 'm': ['Mu'],\n" " 'p': ['psi'],\n" " 't': ['theta'],\n" " 'x': ['chi'],\n" " 'z': ['Zeta']\n" " }", build_package_data_string(self.project))
class ProjectPackageDataTests(unittest.TestCase): def setUp(self): self.project = Project(basedir="/imaginary", name="Unittest") def test_should_raise_exception_when_filename_not_given(self): self.assertRaises(ValueError, self.project.include_file, "my_package", None) def test_should_raise_exception_when_filename_is_empty_string(self): self.assertRaises(ValueError, self.project.include_file, "eggs", "\t \n") def test_should_raise_exception_when_package_path_not_given(self): self.assertRaises(ValueError, self.project.include_directory, None, "spam") def test_should_raise_exception_when_package_path_is_empty_string(self): self.assertRaises(ValueError, self.project.include_directory, "\t \n", "spam") def test_should_raise_exception_when_patterns_list_not_given(self): self.assertRaises(ValueError, self.project.include_directory, "spam", None) def test_should_raise_exception_when_patterns_list_is_empty_list(self): self.assertRaises(ValueError, self.project.include_directory, "spam", ["\t \n"]) def test_should_package_data_dictionary_is_empty(self): self.assertEqual({}, self.project.package_data) def test_should_add_filename_to_list_of_included_files_for_package_spam( self): self.project.include_file("spam", "eggs") self.assertEqual({"spam": ["eggs"]}, self.project.package_data) def test_should_add_two_filenames_to_list_of_included_files_for_package_spam( self): self.project.include_file("spam", "eggs") self.project.include_file("spam", "ham") self.assertEqual({"spam": ["eggs", "ham"]}, self.project.package_data) def test_should_add_two_filenames_to_list_of_included_files_for_two_different_packages( self): self.project.include_file("spam", "eggs") self.project.include_file("monty", "ham") self.assertEqual({ "monty": ["ham"], "spam": ["eggs"] }, self.project.package_data) def test_should_add_two_filenames_to_list_of_included_files_and_to_manifest( self): self.project.include_file("spam", "eggs") self.project.include_file("monty", "ham") self.assertEqual({ "monty": ["ham"], "spam": ["eggs"] }, self.project.package_data) self.assertEqual([np("spam/eggs"), np("monty/ham")], self.project.manifest_included_files) @patch("pybuilder.core.os.walk") def test_should_add_pattern_to_list_of_included_filed_for_package_spam( self, walk): walk.return_value = [ [ jp(self.project.basedir, "spam"), ("foo", "bar"), ("bacon.eggs", "bacon.noeggs") ], ] self.project.include_directory("spam", "*.eggs") self.assertEqual({"spam": ["bacon.eggs"]}, self.project.package_data)