@@ -887,21 +887,30 @@ def test_source_include_exclusive(self):
887
887
cov .start ()
888
888
cov .stop () # pragma: nested
889
889
890
+ def test_source_package_as_package (self ):
891
+ self .assertFalse (os .path .isdir ("pkg1" ))
892
+ lines = self .coverage_usepkgs (source = ["pkg1" ])
893
+ self .filenames_in (lines , "p1a p1b" )
894
+ self .filenames_not_in (lines , "p2a p2b othera otherb osa osb" )
895
+ # Because source= was specified, we do search for unexecuted files.
896
+ self .assertEqual (lines ['p1c' ], 0 )
897
+
890
898
def test_source_package_as_dir (self ):
891
- # pkg1 is a directory, since we cd'd into tests/modules in setUp.
899
+ self .chdir (self .nice_file (TESTS_DIR , 'modules' ))
900
+ self .assertTrue (os .path .isdir ("pkg1" ))
892
901
lines = self .coverage_usepkgs (source = ["pkg1" ])
893
902
self .filenames_in (lines , "p1a p1b" )
894
903
self .filenames_not_in (lines , "p2a p2b othera otherb osa osb" )
895
904
# Because source= was specified, we do search for unexecuted files.
896
905
self .assertEqual (lines ['p1c' ], 0 )
897
906
898
- def test_source_package_as_package (self ):
907
+ def test_source_package_dotted_sub (self ):
899
908
lines = self .coverage_usepkgs (source = ["pkg1.sub" ])
900
909
self .filenames_not_in (lines , "p2a p2b othera otherb osa osb" )
901
910
# Because source= was specified, we do search for unexecuted files.
902
911
self .assertEqual (lines ['runmod3' ], 0 )
903
912
904
- def test_source_package_dotted (self ):
913
+ def test_source_package_dotted_p1b (self ):
905
914
lines = self .coverage_usepkgs (source = ["pkg1.p1b" ])
906
915
self .filenames_in (lines , "p1b" )
907
916
self .filenames_not_in (lines , "p1a p1c p2a p2b othera otherb osa osb" )
0 commit comments