@@ -998,21 +998,24 @@ class TestRunnerPluginTest(CoverageTest):
998
998
way they do.
999
999
1000
1000
"""
1001
- def pretend_to_be_nose_with_cover (self , erase ):
1001
+ def pretend_to_be_nose_with_cover (self , erase = False , cd = False ):
1002
1002
"""This is what the nose --with-cover plugin does."""
1003
1003
self .make_file ("no_biggie.py" , """\
1004
1004
a = 1
1005
1005
b = 2
1006
1006
if b == 1:
1007
1007
c = 4
1008
1008
""" )
1009
+ self .make_file ("sub/hold.txt" , "" )
1009
1010
1010
1011
cov = coverage .Coverage ()
1011
1012
if erase :
1012
1013
cov .combine ()
1013
1014
cov .erase ()
1014
1015
cov .load ()
1015
1016
self .start_import_stop (cov , "no_biggie" )
1017
+ if cd :
1018
+ os .chdir ("sub" )
1016
1019
cov .combine ()
1017
1020
cov .save ()
1018
1021
cov .report (["no_biggie.py" ], show_missing = True )
@@ -1021,13 +1024,19 @@ def pretend_to_be_nose_with_cover(self, erase):
1021
1024
--------------------------------------------
1022
1025
no_biggie.py 4 1 75% 4
1023
1026
""" ))
1027
+ if cd :
1028
+ os .chdir (".." )
1024
1029
1025
1030
def test_nose_plugin (self ):
1026
- self .pretend_to_be_nose_with_cover (erase = False )
1031
+ self .pretend_to_be_nose_with_cover ()
1027
1032
1028
1033
def test_nose_plugin_with_erase (self ):
1029
1034
self .pretend_to_be_nose_with_cover (erase = True )
1030
1035
1036
+ def test_nose_plugin_with_cd (self ):
1037
+ # https://github.com/nedbat/coveragepy/issues/916
1038
+ self .pretend_to_be_nose_with_cover (cd = True )
1039
+
1031
1040
def pretend_to_be_pytestcov (self , append ):
1032
1041
"""Act like pytest-cov."""
1033
1042
self .make_file ("prog.py" , """\
0 commit comments