Ronny Pfannschmidt  committed 9b52947

add some tests for the pth writer/manager

  • Participants
  • Parent commits 35edad5
  • Branches 0.6-maintenance

Comments (0)

Files changed (1)

File setuptools/tests/

 import sys
 import os, shutil, tempfile, unittest
 from setuptools.command.easy_install import easy_install, get_script_args, main
+from setuptools.command.easy_install import  PthDistributions
 from setuptools.dist import Distribution
+from pkg_resources import Distribution as PRDistribution
 class FakeDist(object):
     def get_entry_map(self, group):
+class TestPTHFileWriter(unittest.TestCase):
+    def test_add_from_cwd_site_sets_dirty(self):
+        '''a pth file manager should set dirty 
+        if a distribution is in site but also the cwd
+        '''
+        pth = PthDistributions('does-not_exist', [os.getcwd()])
+        self.assertFalse(pth.dirty)
+        pth.add(PRDistribution(os.getcwd()))
+        self.assertTrue(pth.dirty)
+    def test_add_from_site_is_ignored(self):
+        pth = PthDistributions('does-not_exist', ['/test/location/does-not-have-to-exist'])
+        self.assertFalse(pth.dirty)
+        pth.add(PRDistribution('/test/location/does-not-have-to-exist'))
+        self.assertFalse(pth.dirty)