예제 #1
0
 def test_python_from_path(self):
     # https://github.com/mgedmin/check-manifest/issues/57
     # NB: this test assumes you have a 'python' executable somewhere
     # in your path.
     from check_manifest import check_manifest
     subdir = self._create_repo_with_code_in_subdir()
     self.assertTrue(check_manifest(subdir, python='python'))
예제 #2
0
 def test_setup_py_does_not_need_to_be_added_to_be_considered(self):
     from check_manifest import check_manifest
     self._create_repo_with_code(add_to_vcs=False)
     self._add_to_vcs('sample.py')
     self.assertFalse(check_manifest())
     self.assertIn("missing from VCS:\n  setup.py", sys.stderr.getvalue())
     self.assertNotIn("missing from sdist", sys.stderr.getvalue())
예제 #3
0
 def test_python_from_path(self):
     # https://github.com/mgedmin/check-manifest/issues/57
     # NB: this test assumes you have a 'python' executable somewhere
     # in your path.
     from check_manifest import check_manifest
     subdir = self._create_repo_with_code_in_subdir()
     self.assertTrue(check_manifest(subdir, python='python'))
예제 #4
0
 def test_setup_py_does_not_need_to_be_added_to_be_considered(self):
     from check_manifest import check_manifest
     self._create_repo_with_code(add_to_vcs=False)
     self._add_to_vcs('sample.py')
     self.assertFalse(check_manifest())
     self.assertIn("missing from VCS:\n  setup.py", sys.stderr.getvalue())
     self.assertNotIn("missing from sdist", sys.stderr.getvalue())
예제 #5
0
 def test_missing_source_files(self):
     # https://github.com/mgedmin/check-manifest/issues/32
     from check_manifest import check_manifest
     self._create_repo_with_code()
     self._add_to_vcs('missing.py')
     os.unlink('missing.py')
     check_manifest()
     if self._vcs.command != 'bzr':
         # 'bzr ls' doesn't list files that were deleted but not
         # marked for deletion.  'bzr st' does, but it doesn't list
         # unmodified files.  Importing bzrlib and using the API to
         # get the file list we need is (a) complicated, (b) opens
         # the optional dependency can of worms, and (c) not viable
         # under Python 3 unless we fork off a Python 2 subprocess.
         # Manually combining 'bzr ls' and 'bzr st' outputs just to
         # produce a cosmetic warning message seems like overkill.
         self.assertIn("some files listed as being under source control are missing:\n  missing.py",
                     sys.stderr.getvalue())
예제 #6
0
 def test_MANIFEST_in_does_not_need_to_be_added_to_be_considered(self):
     from check_manifest import check_manifest
     self._create_repo_with_code()
     self._add_to_vcs('unrelated.txt')
     with open('MANIFEST.in', 'w') as f:
         f.write("include *.txt\n")
     self.assertFalse(check_manifest())
     self.assertIn("missing from VCS:\n  MANIFEST.in", sys.stderr.getvalue())
     self.assertNotIn("missing from sdist", sys.stderr.getvalue())
예제 #7
0
 def test_missing_source_files(self):
     # https://github.com/mgedmin/check-manifest/issues/32
     from check_manifest import check_manifest
     self._create_repo_with_code()
     self._add_to_vcs('missing.py')
     os.unlink('missing.py')
     check_manifest()
     if self._vcs.command != 'bzr':
         # 'bzr ls' doesn't list files that were deleted but not
         # marked for deletion.  'bzr st' does, but it doesn't list
         # unmodified files.  Importing bzrlib and using the API to
         # get the file list we need is (a) complicated, (b) opens
         # the optional dependency can of worms, and (c) not viable
         # under Python 3 unless we fork off a Python 2 subprocess.
         # Manually combining 'bzr ls' and 'bzr st' outputs just to
         # produce a cosmetic warning message seems like overkill.
         self.assertIn("some files listed as being under source control are missing:\n  missing.py",
                     sys.stderr.getvalue())
예제 #8
0
 def test_suggestions(self):
     from check_manifest import check_manifest
     self._create_repo_with_code()
     self._add_to_vcs('unrelated.txt')
     self.assertFalse(check_manifest())
     self.assertIn("missing from sdist:\n  unrelated.txt",
                   sys.stderr.getvalue())
     self.assertIn("suggested MANIFEST.in rules:\n  include *.txt",
                   sys.stdout.getvalue())
예제 #9
0
 def test_MANIFEST_in_does_not_need_to_be_added_to_be_considered(self):
     from check_manifest import check_manifest
     self._create_repo_with_code()
     self._add_to_vcs('unrelated.txt')
     with open('MANIFEST.in', 'w') as f:
         f.write("include *.txt\n")
     self.assertFalse(check_manifest())
     self.assertIn("missing from VCS:\n  MANIFEST.in", sys.stderr.getvalue())
     self.assertNotIn("missing from sdist", sys.stderr.getvalue())
예제 #10
0
 def test_suggestions(self):
     from check_manifest import check_manifest
     self._create_repo_with_code()
     self._add_to_vcs('unrelated.txt')
     self.assertFalse(check_manifest())
     self.assertIn("missing from sdist:\n  unrelated.txt",
                   sys.stderr.getvalue())
     self.assertIn("suggested MANIFEST.in rules:\n  include *.txt",
                   sys.stdout.getvalue())
예제 #11
0
 def test_suggestions_all_unknown_patterns(self):
     from check_manifest import check_manifest
     self._create_repo_with_code()
     self._add_to_vcs('.dunno-what-to-do-with-this')
     self.assertFalse(check_manifest(update=True))
     self.assertIn("missing from sdist:\n  .dunno-what-to-do-with-this",
                   sys.stderr.getvalue())
     self.assertIn(
         "don't know how to come up with rules matching any of the files, sorry!",
         sys.stdout.getvalue())
예제 #12
0
 def test_suggestions_all_unknown_patterns(self):
     from check_manifest import check_manifest
     self._create_repo_with_code()
     self._add_to_vcs('.dunno-what-to-do-with-this')
     self.assertFalse(check_manifest(update=True))
     self.assertIn("missing from sdist:\n  .dunno-what-to-do-with-this",
                   sys.stderr.getvalue())
     self.assertIn(
         "don't know how to come up with rules matching any of the files, sorry!",
         sys.stdout.getvalue())
예제 #13
0
 def test_bad_ideas(self):
     from check_manifest import check_manifest
     self._create_repo_with_code()
     self._add_to_vcs('foo.egg-info')
     self._add_to_vcs('moo.mo')
     self.assertFalse(check_manifest())
     self.assertIn("you have foo.egg-info in source control!",
                   sys.stderr.getvalue())
     self.assertIn("this also applies to the following:\n  moo.mo",
                   sys.stderr.getvalue())
예제 #14
0
 def test_bad_ideas(self):
     from check_manifest import check_manifest
     self._create_repo_with_code()
     self._add_to_vcs('foo.egg-info')
     self._add_to_vcs('moo.mo')
     self.assertFalse(check_manifest())
     self.assertIn("you have foo.egg-info in source control!",
                   sys.stderr.getvalue())
     self.assertIn("this also applies to the following:\n  moo.mo",
                   sys.stderr.getvalue())
예제 #15
0
 def test_suggestions_some_unknown_patterns(self):
     from check_manifest import check_manifest
     self._create_repo_with_code()
     self._add_to_vcs('.dunno-what-to-do-with-this')
     self._add_to_vcs('unrelated.txt')
     self.assertFalse(check_manifest(update=True))
     self.assertIn(
         "don't know how to come up with rules matching\n  .dunno-what-to-do-with-this",
         sys.stdout.getvalue())
     self.assertIn("creating MANIFEST.in", sys.stdout.getvalue())
     with open('MANIFEST.in') as f:
         self.assertEqual(f.read(), "include *.txt\n")
예제 #16
0
 def test_suggestions_create(self):
     from check_manifest import check_manifest
     self._create_repo_with_code()
     self._add_to_vcs('unrelated.txt')
     self.assertFalse(check_manifest(create=True))
     self.assertIn("missing from sdist:\n  unrelated.txt",
                   sys.stderr.getvalue())
     self.assertIn("suggested MANIFEST.in rules:\n  include *.txt",
                   sys.stdout.getvalue())
     self.assertIn("creating MANIFEST.in", sys.stdout.getvalue())
     with open('MANIFEST.in') as f:
         self.assertEqual(f.read(), "include *.txt\n")
예제 #17
0
 def test_suggestions_some_unknown_patterns(self):
     from check_manifest import check_manifest
     self._create_repo_with_code()
     self._add_to_vcs('.dunno-what-to-do-with-this')
     self._add_to_vcs('unrelated.txt')
     self.assertFalse(check_manifest(update=True))
     self.assertIn(
         "don't know how to come up with rules matching\n  .dunno-what-to-do-with-this",
         sys.stdout.getvalue())
     self.assertIn("creating MANIFEST.in",
                   sys.stdout.getvalue())
     with open('MANIFEST.in') as f:
         self.assertEqual(f.read(), "include *.txt\n")
예제 #18
0
 def test_suggestions_create(self):
     from check_manifest import check_manifest
     self._create_repo_with_code()
     self._add_to_vcs('unrelated.txt')
     self.assertFalse(check_manifest(create=True))
     self.assertIn("missing from sdist:\n  unrelated.txt",
                   sys.stderr.getvalue())
     self.assertIn("suggested MANIFEST.in rules:\n  include *.txt",
                   sys.stdout.getvalue())
     self.assertIn("creating MANIFEST.in",
                   sys.stdout.getvalue())
     with open('MANIFEST.in') as f:
         self.assertEqual(f.read(), "include *.txt\n")
예제 #19
0
 def test_not_python_project(self):
     from check_manifest import check_manifest, Failure
     with self.assertRaises(Failure) as cm:
         check_manifest()
     self.assertEqual(str(cm.exception),
                      "This is not a Python project (no setup.py).")
예제 #20
0
 def test_all_is_well(self):
     from check_manifest import check_manifest
     self._create_repo_with_code()
     self.assertTrue(check_manifest())
예제 #21
0
 def test_not_python_project(self):
     from check_manifest import check_manifest, Failure
     with self.assertRaises(Failure) as cm:
         check_manifest()
     self.assertEqual(str(cm.exception),
                      "This is not a Python project (no setup.py).")
예제 #22
0
 def test_relative_python(self):
     from check_manifest import check_manifest
     subdir = self._create_repo_with_code_in_subdir()
     python = os.path.relpath(sys.executable)
     self.assertTrue(check_manifest(subdir, python=python))
예제 #23
0
 def test_relative_pathname(self):
     from check_manifest import check_manifest
     subdir = self._create_repo_with_code_in_subdir()
     self.assertTrue(check_manifest(subdir))
예제 #24
0
 def test_relative_python(self):
     # https://github.com/mgedmin/check-manifest/issues/36
     from check_manifest import check_manifest
     subdir = self._create_repo_with_code_in_subdir()
     python = os.path.relpath(sys.executable)
     self.assertTrue(check_manifest(subdir, python=python))
예제 #25
0
 def test_relative_python(self):
     from check_manifest import check_manifest
     subdir = self._create_repo_with_code_in_subdir()
     python = os.path.relpath(sys.executable)
     self.assertTrue(check_manifest(subdir, python=python))
예제 #26
0
 def test_all_is_well(self):
     from check_manifest import check_manifest
     self._create_repo_with_code()
     self.assertTrue(check_manifest())
예제 #27
0
 def test_relative_python(self):
     # https://github.com/mgedmin/check-manifest/issues/36
     from check_manifest import check_manifest
     subdir = self._create_repo_with_code_in_subdir()
     python = os.path.relpath(sys.executable)
     self.assertTrue(check_manifest(subdir, python=python))
예제 #28
0
 def test_relative_pathname(self):
     from check_manifest import check_manifest
     subdir = self._create_repo_with_code_in_subdir()
     self.assertTrue(check_manifest(subdir))