Exemplo n.º 1
0
 def test_create_setup_file(self):
     build = Build()
     settings = build.get_settings_from_package_file()
     build.create_setup_file(settings)
     with open('setup.py', 'r') as f:
         setup = f.read()
         self.assertIn('name = \'foobar\'', setup)
         self.assertIn('version = \'0.0.0\'', setup)
         self.assertIn('install_requires = [\'Jinja2\']', setup)
         self.assertIn(
             'entry_points = {\'console_scripts\': [\'foo=foobar.foo:foo\', \'bar=foobar.bar:bar\']}',
             setup)
Exemplo n.º 2
0
 def test_create_manifest_file(self):
     settings = {'files': ['README.md', 'foobar/bar']}
     Build().create_manifest_file(settings)
     with open('MANIFEST.in', 'r') as f:
         manifest = f.read()
         expected = 'include README.md\nrecursive-include foobar/bar *\n'
         self.assertEqual(manifest, expected)
Exemplo n.º 3
0
 def test_publish_does_not_run_if_no_env_is_specified(self):
     Build().run()
     with self.assertRaises(SystemExit):
         Publish().run()
Exemplo n.º 4
0
 def test_build_command_overwrites_stale_dist_directory(self):
     os.mkdir('dist')
     open('dist/foobar.stale', 'a').close()
     Build().run()
     self.assertFalse(os.path.isfile('dist/foobar.stale'))
Exemplo n.º 5
0
 def test_manifest_is_not_created_if_theres_no_files_to_include(self):
     settings = {'files': []}
     Build().create_manifest_file(settings)
     self.assertFalse(os.path.isfile('MANIFEST.in'))
Exemplo n.º 6
0
 def test_build_does_not_leave_garbage_behind(self):
     Build().run()
     self.assertFalse(os.path.isfile('setup.py'))
     self.assertFalse(os.path.isfile('MANIFEST.in'))
     self.assertFalse(os.path.isdir('foobar.egg-info'))
     self.assertFalse(os.path.isdir('build'))
Exemplo n.º 7
0
 def test_build_command_creates_build_files(self):
     Build().run()
     self.assertTrue(os.path.isfile('dist/foobar-0.0.0.tar.gz'))
     self.assertTrue(
         os.path.isfile('dist/foobar-0.0.0-py2.py3-none-any.whl'))
Exemplo n.º 8
0
 def test_build_executes_without_error(self):
     Build().run()
     self.assertTrue(os.path.isdir('dist'))
Exemplo n.º 9
0
 def test_register_does_not_run_if_no_env_is_specified(self):
     Build().run()
     with self.assertRaises(SystemExit):
         Register().run()