@@ -173,10 +173,7 @@ def discover(self, start_dir, pattern='test*.py', top_level_dir=None):
173173
174174 if not top_level_dir in sys .path :
175175 # all test modules must be importable from the top level directory
176- # should we *unconditionally* put the start directory in first
177- # in sys.path to minimise likelihood of conflicts between installed
178- # modules and development versions?
179- sys .path .insert (0 , top_level_dir )
176+ sys .path .append (top_level_dir )
180177 self ._top_level_dir = top_level_dir
181178
182179 is_not_importable = False
@@ -249,16 +246,6 @@ def _find_tests(self, start_dir, pattern):
249246 except :
250247 yield _make_failed_import_test (name , self .suiteClass )
251248 else :
252- mod_file = os .path .abspath (getattr (module , '__file__' , full_path ))
253- realpath = os .path .splitext (mod_file )[0 ]
254- fullpath_noext = os .path .splitext (full_path )[0 ]
255- if realpath .lower () != fullpath_noext .lower ():
256- module_dir = os .path .dirname (realpath )
257- mod_name = os .path .splitext (os .path .basename (full_path ))[0 ]
258- expected_dir = os .path .dirname (full_path )
259- msg = ("%r module incorrectly imported from %r. Expected %r. "
260- "Is this module globally installed?" )
261- raise ImportError (msg % (mod_name , module_dir , expected_dir ))
262249 yield self .loadTestsFromModule (module )
263250 elif os .path .isdir (full_path ):
264251 if not os .path .isfile (os .path .join (full_path , '__init__.py' )):
0 commit comments