File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ Alex Gaynor
11
11
Alex Groce
12
12
Alex Sandro
13
13
Alexander Todorov
14
+ Alexander Walters
14
15
Andrew Hoos
15
16
Anthony Sottile
16
17
Arcadiy Ivanov
Original file line number Diff line number Diff line change 9
9
import os
10
10
import os .path
11
11
import re
12
+ import stat
12
13
import sys
13
14
import textwrap
14
15
import time
@@ -1004,6 +1005,23 @@ def test_coverage_custom_script(self):
1004
1005
out = self .run_command ("python -m run_coverage run how_is_it.py" )
1005
1006
self .assertIn ("hello-xyzzy" , out )
1006
1007
1008
+ def test_bug_862 (self ):
1009
+ if env .WINDOWS :
1010
+ self .skipTest ("Windows can't make symlinks" )
1011
+ # This simulates how pyenv and pyenv-virtualenv end up creating the
1012
+ # coverage executable.
1013
+ self .make_file ("elsewhere/bin/fake-coverage" , """\
1014
+ #!{executable}
1015
+ import sys, pkg_resources
1016
+ sys.exit(pkg_resources.load_entry_point('coverage', 'console_scripts', 'coverage')())
1017
+ """ .format (executable = sys .executable ))
1018
+ os .chmod ("elsewhere/bin/fake-coverage" , stat .S_IREAD | stat .S_IEXEC )
1019
+ os .symlink ("elsewhere" , "somewhere" )
1020
+ self .make_file ("foo.py" , "print('inside foo')" )
1021
+ self .make_file ("bar.py" , "import foo" )
1022
+ out = self .run_command ("somewhere/bin/fake-coverage run bar.py" )
1023
+ self .assertEqual ("inside foo\n " , out )
1024
+
1007
1025
def test_bug_909 (self ):
1008
1026
# https://github.com/nedbat/coveragepy/issues/909
1009
1027
# The __init__ files were being imported before measurement started,
You can’t perform that action at this time.
0 commit comments