def test_prints_warning_when_no_egginfo_found(self): stderr = StringIO() with capture_streams(stderr=stderr): self.assertEqual(None, find_egginfo(self.path)) self.assertEquals('WARNING: no *.egg-info directory could be found.\n', stderr.getvalue())
def test_prints_warning_when_multiple_egginfos_found(self): create(self.package_builder) create(Builder('python package').named('another.package').at_path(self.path)) stderr = StringIO() with capture_streams(stderr=stderr): self.assertEqual(None, find_egginfo(self.path)) self.assertEquals('WARNING: more than one *.egg-info directory found.\n', stderr.getvalue())
def test_prints_warning_when_multiple_egginfos_found(self): create(self.package_builder) create( Builder('python package').named('another.package').at_path( self.path)) stderr = StringIO() with capture_streams(stderr=stderr): self.assertEqual(None, find_egginfo(self.path)) self.assertEquals( 'WARNING: more than one *.egg-info directory found.\n', stderr.getvalue())
def default_upgrades_directory(): egginfo = find_egginfo() if not egginfo: return None package_namespace_path = find_package_namespace_path(egginfo) upgrades_dirs = tuple(package_namespace_path.walkdirs('upgrades')) if len(upgrades_dirs) == 0: print >> sys.stderr, 'WARNING: no "upgrades" directory could be found.' return None if len(upgrades_dirs) > 1: print >>sys.stderr, 'WARNING: more than one "upgrades"' + \ ' directory found.' return None return upgrades_dirs[0]
def default_upgrades_directory(): egginfo = find_egginfo() if not egginfo: return None package_namespace_path = find_package_namespace_path(egginfo) upgrades_dirs = tuple(package_namespace_path.walkdirs('upgrades')) if len(upgrades_dirs) == 0: print >>sys.stderr, 'WARNING: no "upgrades" directory could be found.' return None if len(upgrades_dirs) > 1: print >>sys.stderr, 'WARNING: more than one "upgrades"' + \ ' directory found.' return None return upgrades_dirs[0]
def test_returns_absolute_path_to_toplevel_namespace_directory(self): create( Builder('python package').named('the.package').at_path(self.path)) egginfo = find_egginfo(self.path) self.assertEquals(self.path.joinpath('the'), find_package_namespace_path(egginfo))
def test_working_directory_used_when_no_path_passed_to_in(self): create(self.package_builder) with chdir(self.path): self.assertEqual(self.path.joinpath('the.package.egg-info'), find_egginfo())
def test_finds_egginfo_in_current_directory(self): create(self.package_builder) self.assertEqual(self.path.joinpath('the.package.egg-info'), find_egginfo(self.path))
def test_returns_absolute_path_to_toplevel_namespace_directory(self): create(Builder('python package').named('the.package').at_path(self.path)) egginfo = find_egginfo(self.path) self.assertEquals(self.path.joinpath('the'), find_package_namespace_path(egginfo))