File tree 1 file changed +30
-0
lines changed 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
14
15
+ import os
16
+ import pathlib
17
+ import sys
15
18
import unittest
16
19
17
20
from lib import main
18
21
19
22
20
23
class ExampleTest (unittest .TestCase ):
24
+ def test_coverage (self ):
25
+ for i , path in enumerate (sys .path [1 :- 2 ]):
26
+ paths = ",\n " .join (sys .path )
27
+
28
+ self .assertFalse (
29
+ "/coverage" in path ,
30
+ f"Expected { i + 2 } th '{ path } ' to not contain 'coverage.py' paths, "
31
+ f"sys.path has { len (sys .path )} items:\n { paths } " ,
32
+ )
33
+
34
+ first_item , last_item = sys .path [0 ], sys .path [- 1 ]
35
+ self .assertFalse (
36
+ first_item .endswith ("coverage" ),
37
+ f"Expected the first item in sys.path '{ first_item } ' to not be related to coverage" ,
38
+ )
39
+ if os .environ .get ("COVERAGE_MANIFEST" ):
40
+ # we are running under the 'bazel coverage :test'
41
+ self .assertTrue (
42
+ "pypi__coverage_cp" in last_item ,
43
+ f"Expected { last_item } to be related to coverage" ,
44
+ )
45
+ self .assertEqual (pathlib .Path (last_item ).name , "coverage" )
46
+ else :
47
+ self .assertFalse (
48
+ "coverage" in last_item , f"Expected coverage tooling to not be present"
49
+ )
50
+
21
51
def test_main (self ):
22
52
self .assertEquals (
23
53
"""\
You can’t perform that action at this time.
0 commit comments