Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
95333e3a
Commit
95333e3a
authored
Dec 14, 2010
by
R. David Murray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More comprehensive compileall cli tests, and fixes.
parent
e7fed672
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
176 additions
and
89 deletions
+176
-89
Lib/compileall.py
Lib/compileall.py
+20
-14
Lib/test/test_compileall.py
Lib/test/test_compileall.py
+156
-75
No files found.
Lib/compileall.py
View file @
95333e3a
...
@@ -181,24 +181,29 @@ def main():
...
@@ -181,24 +181,29 @@ def main():
'of the file'
))
'of the file'
))
parser
.
add_argument
(
'-i'
,
metavar
=
'FILE'
,
dest
=
'flist'
,
parser
.
add_argument
(
'-i'
,
metavar
=
'FILE'
,
dest
=
'flist'
,
help
=
'expand the list with the content of FILE.'
)
help
=
'expand the list with the content of FILE.'
)
parser
.
add_argument
(
'compile_dest'
,
metavar
=
'FILE|DIR'
,
nargs
=
'
?
'
)
parser
.
add_argument
(
'compile_dest'
,
metavar
=
'FILE|DIR'
,
nargs
=
'
*
'
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
if
(
args
.
ddir
and
args
.
compile_dest
!=
1
and
compile_dests
=
args
.
compile_dest
not
os
.
path
.
isdir
(
args
.
compile_dest
)):
raise
argparse
.
ArgumentError
(
if
(
args
.
ddir
and
(
len
(
compile_dests
)
!=
1
"-d destdir requires exactly one directory argument"
)
or
not
os
.
path
.
isdir
(
compile_dests
[
0
]))):
parser
.
exit
(
'-d destdir requires exactly one directory argument'
)
if
args
.
rx
:
if
args
.
rx
:
import
re
import
re
args
.
rx
=
re
.
compile
(
args
.
rx
)
args
.
rx
=
re
.
compile
(
args
.
rx
)
# if flist is provided then load it
# if flist is provided then load it
compile_dests
=
[
args
.
compile_dest
]
if
args
.
flist
:
if
args
.
flist
:
with
open
(
args
.
flist
)
as
f
:
try
:
files
=
f
.
read
().
split
()
with
(
sys
.
stdin
if
args
.
flist
==
'-'
else
open
(
args
.
flist
))
as
f
:
compile_dests
.
extend
(
files
)
for
line
in
f
:
compile_dests
.
append
(
line
.
strip
())
except
EnvironmentError
:
print
(
"Error reading file list {}"
.
format
(
args
.
flist
))
return
False
success
=
True
try
:
try
:
if
compile_dests
:
if
compile_dests
:
for
dest
in
compile_dests
:
for
dest
in
compile_dests
:
...
@@ -206,17 +211,18 @@ def main():
...
@@ -206,17 +211,18 @@ def main():
if
not
compile_dir
(
dest
,
args
.
maxlevels
,
args
.
ddir
,
if
not
compile_dir
(
dest
,
args
.
maxlevels
,
args
.
ddir
,
args
.
force
,
args
.
rx
,
args
.
quiet
,
args
.
force
,
args
.
rx
,
args
.
quiet
,
args
.
legacy
):
args
.
legacy
):
return
0
success
=
False
else
:
else
:
if
not
compile_file
(
dest
,
args
.
ddir
,
args
.
force
,
args
.
rx
,
if
not
compile_file
(
dest
,
args
.
ddir
,
args
.
force
,
args
.
rx
,
args
.
quiet
,
args
.
legacy
):
args
.
quiet
,
args
.
legacy
):
return
0
success
=
False
return
success
else
:
else
:
return
compile_path
(
legacy
=
args
.
legacy
)
return
compile_path
(
legacy
=
args
.
legacy
)
except
KeyboardInterrupt
:
except
KeyboardInterrupt
:
print
(
"
\
n
[interrupted]"
)
print
(
"
\
n
[interrupted]"
)
return
0
return
False
return
1
return
True
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
Lib/test/test_compileall.py
View file @
95333e3a
...
@@ -11,7 +11,7 @@ import time
...
@@ -11,7 +11,7 @@ import time
import
unittest
import
unittest
import
io
import
io
from
test
import
support
from
test
import
support
,
script_helper
class
CompileallTests
(
unittest
.
TestCase
):
class
CompileallTests
(
unittest
.
TestCase
):
...
@@ -124,16 +124,31 @@ class EncodingTest(unittest.TestCase):
...
@@ -124,16 +124,31 @@ class EncodingTest(unittest.TestCase):
class
CommandLineTests
(
unittest
.
TestCase
):
class
CommandLineTests
(
unittest
.
TestCase
):
"""Test compileall's CLI."""
"""Test compileall's CLI."""
def
assertRunOK
(
self
,
*
args
):
rc
,
out
,
err
=
script_helper
.
assert_python_ok
(
'-m'
,
'compileall'
,
*
args
)
self
.
assertEqual
(
b''
,
err
)
return
out
def
assertRunNotOK
(
self
,
*
args
):
rc
,
out
,
err
=
script_helper
.
assert_python_failure
(
'-m'
,
'compileall'
,
*
args
)
return
rc
,
out
,
err
def
assertCompiled
(
self
,
fn
):
self
.
assertTrue
(
os
.
path
.
exists
(
imp
.
cache_from_source
(
fn
)))
def
assertNotCompiled
(
self
,
fn
):
self
.
assertFalse
(
os
.
path
.
exists
(
imp
.
cache_from_source
(
fn
)))
def
setUp
(
self
):
def
setUp
(
self
):
self
.
addCleanup
(
self
.
_cleanup
)
self
.
addCleanup
(
self
.
_cleanup
)
self
.
directory
=
tempfile
.
mkdtemp
()
self
.
directory
=
tempfile
.
mkdtemp
()
self
.
pkgdir
=
os
.
path
.
join
(
self
.
directory
,
'foo'
)
self
.
pkgdir
=
os
.
path
.
join
(
self
.
directory
,
'foo'
)
os
.
mkdir
(
self
.
pkgdir
)
os
.
mkdir
(
self
.
pkgdir
)
# Touch the __init__.py and a package module.
self
.
pkgdir_cachedir
=
os
.
path
.
join
(
self
.
pkgdir
,
'__pycache__'
)
with
open
(
os
.
path
.
join
(
self
.
pkgdir
,
'__init__.py'
),
'w'
):
# Create the __init__.py and a package module.
pass
self
.
initfn
=
script_helper
.
make_script
(
self
.
pkgdir
,
'__init__'
,
''
)
with
open
(
os
.
path
.
join
(
self
.
pkgdir
,
'bar.py'
),
'w'
):
self
.
barfn
=
script_helper
.
make_script
(
self
.
pkgdir
,
'bar'
,
''
)
pass
sys
.
path
.
insert
(
0
,
self
.
directory
)
sys
.
path
.
insert
(
0
,
self
.
directory
)
def
_cleanup
(
self
):
def
_cleanup
(
self
):
...
@@ -149,103 +164,169 @@ class CommandLineTests(unittest.TestCase):
...
@@ -149,103 +164,169 @@ class CommandLineTests(unittest.TestCase):
(
'doubleoptimize'
,
'pyo'
,
[
'-OO'
]),
(
'doubleoptimize'
,
'pyo'
,
[
'-OO'
]),
]:
]:
def
f
(
self
,
ext
=
ext
,
switch
=
switch
):
def
f
(
self
,
ext
=
ext
,
switch
=
switch
):
retcode
=
subprocess
.
call
(
script_helper
.
assert_python_ok
(
*
(
switch
+
[
sys
.
executable
]
+
switch
+
[
'-m'
,
'compileall'
,
'-q'
,
self
.
pkgdir
]))
[
'-m'
,
'compileall'
,
'-q'
,
self
.
pkgdir
])
self
.
assertEqual
(
retcode
,
0
)
# Verify the __pycache__ directory contents.
# Verify the __pycache__ directory contents.
cachedir
=
os
.
path
.
join
(
self
.
pkgdir
,
'__pycache__'
)
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
pkgdir_cachedir
))
self
.
assertTrue
(
os
.
path
.
exists
(
cachedir
))
expected
=
sorted
(
base
.
format
(
imp
.
get_tag
(),
ext
)
for
base
in
expected
=
sorted
(
base
.
format
(
imp
.
get_tag
(),
ext
)
for
base
in
(
'__init__.{}.{}'
,
'bar.{}.{}'
))
(
'__init__.{}.{}'
,
'bar.{}.{}'
))
self
.
assertEqual
(
sorted
(
os
.
listdir
(
cachedir
)),
expected
)
self
.
assertEqual
(
sorted
(
os
.
listdir
(
self
.
pkgdir_
cachedir
)),
expected
)
# Make sure there are no .pyc files in the source directory.
# Make sure there are no .pyc files in the source directory.
self
.
assertFalse
([
pyc_file
for
pyc_file
in
os
.
listdir
(
self
.
pkgdir
)
self
.
assertFalse
([
fn
for
fn
in
os
.
listdir
(
self
.
pkgdir
)
if
pyc_file
.
endswith
(
ext
)])
if
fn
.
endswith
(
ext
)])
locals
()[
'test_pep3147_paths_'
+
name
]
=
f
locals
()[
'test_pep3147_paths_'
+
name
]
=
f
def
test_legacy_paths
(
self
):
def
test_legacy_paths
(
self
):
# Ensure that with the proper switch, compileall leaves legacy
# Ensure that with the proper switch, compileall leaves legacy
# pyc/pyo files, and no __pycache__ directory.
# pyc/pyo files, and no __pycache__ directory.
retcode
=
subprocess
.
call
(
self
.
assertRunOK
(
'-b'
,
'-q'
,
self
.
pkgdir
)
(
sys
.
executable
,
'-m'
,
'compileall'
,
'-b'
,
'-q'
,
self
.
pkgdir
))
self
.
assertEqual
(
retcode
,
0
)
# Verify the __pycache__ directory contents.
# Verify the __pycache__ directory contents.
cachedir
=
os
.
path
.
join
(
self
.
pkgdir
,
'__pycache__'
)
self
.
assertFalse
(
os
.
path
.
exists
(
self
.
pkgdir_cachedir
))
self
.
assertFalse
(
os
.
path
.
exists
(
cachedir
))
expected
=
sorted
([
'__init__.py'
,
'__init__.pyc'
,
'bar.py'
,
'bar.pyc'
])
expected
=
sorted
([
'__init__.py'
,
'__init__.pyc'
,
'bar.py'
,
'bar.pyc'
])
self
.
assertEqual
(
sorted
(
os
.
listdir
(
self
.
pkgdir
)),
expected
)
self
.
assertEqual
(
sorted
(
os
.
listdir
(
self
.
pkgdir
)),
expected
)
def
test_multiple_runs
(
self
):
def
test_multiple_runs
(
self
):
# Bug 8527 reported that multiple calls produced empty
# Bug 8527 reported that multiple calls produced empty
# __pycache__/__pycache__ directories.
# __pycache__/__pycache__ directories.
retcode
=
subprocess
.
call
(
self
.
assertRunOK
(
'-q'
,
self
.
pkgdir
)
(
sys
.
executable
,
'-m'
,
'compileall'
,
'-q'
,
self
.
pkgdir
))
self
.
assertEqual
(
retcode
,
0
)
# Verify the __pycache__ directory contents.
# Verify the __pycache__ directory contents.
cachedir
=
os
.
path
.
join
(
self
.
pkgdir
,
'__pycache__'
)
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
pkgdir_cachedir
))
self
.
assertTrue
(
os
.
path
.
exists
(
cachedir
))
cachecachedir
=
os
.
path
.
join
(
self
.
pkgdir_cachedir
,
'__pycache__'
)
cachecachedir
=
os
.
path
.
join
(
cachedir
,
'__pycache__'
)
self
.
assertFalse
(
os
.
path
.
exists
(
cachecachedir
))
self
.
assertFalse
(
os
.
path
.
exists
(
cachecachedir
))
# Call compileall again.
# Call compileall again.
retcode
=
subprocess
.
call
(
self
.
assertRunOK
(
'-q'
,
self
.
pkgdir
)
(
sys
.
executable
,
'-m'
,
'compileall'
,
'-q'
,
self
.
pkgdir
))
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
pkgdir_cachedir
))
self
.
assertEqual
(
retcode
,
0
)
self
.
assertTrue
(
os
.
path
.
exists
(
cachedir
))
self
.
assertFalse
(
os
.
path
.
exists
(
cachecachedir
))
self
.
assertFalse
(
os
.
path
.
exists
(
cachecachedir
))
def
test_force
(
self
):
def
test_force
(
self
):
retcode
=
subprocess
.
call
(
self
.
assertRunOK
(
'-q'
,
self
.
pkgdir
)
(
sys
.
executable
,
'-m'
,
'compileall'
,
'-q'
,
self
.
pkgdir
))
pycpath
=
imp
.
cache_from_source
(
self
.
barfn
)
self
.
assertEqual
(
retcode
,
0
)
pycpath
=
imp
.
cache_from_source
(
os
.
path
.
join
(
self
.
pkgdir
,
'bar.py'
))
# set atime/mtime backward to avoid file timestamp resolution issues
# set atime/mtime backward to avoid file timestamp resolution issues
os
.
utime
(
pycpath
,
(
time
.
time
()
-
60
,)
*
2
)
os
.
utime
(
pycpath
,
(
time
.
time
()
-
60
,)
*
2
)
access
=
os
.
stat
(
pycpath
).
st_mtime
mtime
=
os
.
stat
(
pycpath
).
st_mtime
retcode
=
subprocess
.
call
(
# without force, no recompilation
(
sys
.
executable
,
'-m'
,
'compileall'
,
'-q'
,
'-f'
,
self
.
pkgdir
))
self
.
assertRunOK
(
'-q'
,
self
.
pkgdir
)
self
.
assertEqual
(
retcode
,
0
)
mtime2
=
os
.
stat
(
pycpath
).
st_mtime
access2
=
os
.
stat
(
pycpath
).
st_mtime
self
.
assertEqual
(
mtime
,
mtime2
)
self
.
assertNotEqual
(
access
,
access2
)
# now force it.
self
.
assertRunOK
(
'-q'
,
'-f'
,
self
.
pkgdir
)
def
test_legacy
(
self
):
mtime2
=
os
.
stat
(
pycpath
).
st_mtime
# create a new module XXX could rewrite using self.pkgdir
self
.
assertNotEqual
(
mtime
,
mtime2
)
newpackage
=
os
.
path
.
join
(
self
.
pkgdir
,
'spam'
)
os
.
mkdir
(
newpackage
)
def
test_recursion_control
(
self
):
with
open
(
os
.
path
.
join
(
newpackage
,
'__init__.py'
),
'w'
):
subpackage
=
os
.
path
.
join
(
self
.
pkgdir
,
'spam'
)
pass
os
.
mkdir
(
subpackage
)
with
open
(
os
.
path
.
join
(
newpackage
,
'ham.py'
),
'w'
):
subinitfn
=
script_helper
.
make_script
(
subpackage
,
'__init__'
,
''
)
pass
hamfn
=
script_helper
.
make_script
(
subpackage
,
'ham'
,
''
)
sourcefile
=
os
.
path
.
join
(
newpackage
,
'ham.py'
)
self
.
assertRunOK
(
'-q'
,
'-l'
,
self
.
pkgdir
)
self
.
assertNotCompiled
(
subinitfn
)
retcode
=
subprocess
.
call
(
self
.
assertFalse
(
os
.
path
.
exists
(
os
.
path
.
join
(
subpackage
,
'__pycache__'
)))
(
sys
.
executable
,
'-m'
,
'compileall'
,
'-q'
,
'-l'
,
self
.
pkgdir
))
self
.
assertRunOK
(
'-q'
,
self
.
pkgdir
)
self
.
assertEqual
(
retcode
,
0
)
self
.
assertCompiled
(
subinitfn
)
self
.
assertFalse
(
os
.
path
.
exists
(
imp
.
cache_from_source
(
sourcefile
)))
self
.
assertCompiled
(
hamfn
)
retcode
=
subprocess
.
call
(
(
sys
.
executable
,
'-m'
,
'compileall'
,
'-q'
,
self
.
pkgdir
))
self
.
assertEqual
(
retcode
,
0
)
self
.
assertTrue
(
os
.
path
.
exists
(
imp
.
cache_from_source
(
sourcefile
)))
def
test_quiet
(
self
):
def
test_quiet
(
self
):
noise
=
subprocess
.
check_output
(
noisy
=
self
.
assertRunOK
(
self
.
pkgdir
)
[
sys
.
executable
,
'-m'
,
'compileall'
,
self
.
pkgdir
],
quiet
=
self
.
assertRunOK
(
'-q'
,
self
.
pkgdir
)
stderr
=
subprocess
.
STDOUT
)
self
.
assertNotEqual
(
b''
,
noisy
)
quiet
=
subprocess
.
check_output
(
self
.
assertEqual
(
b''
,
quiet
)
[
sys
.
executable
,
'-m'
,
'compileall'
,
'-f'
,
'-q'
,
self
.
pkgdir
],
stderr
=
subprocess
.
STDOUT
)
self
.
assertGreater
(
len
(
noise
),
len
(
quiet
))
def
test_regexp
(
self
):
def
test_regexp
(
self
):
retcode
=
subprocess
.
call
(
self
.
assertRunOK
(
'-q'
,
'-x'
,
'ba.*'
,
self
.
pkgdir
)
(
sys
.
executable
,
'-m'
,
'compileall'
,
'-q'
,
'-x'
,
'bar.*'
,
self
.
pkgdir
))
self
.
assertNotCompiled
(
self
.
barfn
)
self
.
assertEqual
(
retcode
,
0
)
self
.
assertCompiled
(
self
.
initfn
)
sourcefile
=
os
.
path
.
join
(
self
.
pkgdir
,
'bar.py'
)
def
test_multiple_dirs
(
self
):
self
.
assertFalse
(
os
.
path
.
exists
(
imp
.
cache_from_source
(
sourcefile
)))
pkgdir2
=
os
.
path
.
join
(
self
.
directory
,
'foo2'
)
sourcefile
=
os
.
path
.
join
(
self
.
pkgdir
,
'__init__.py'
)
os
.
mkdir
(
pkgdir2
)
self
.
assertTrue
(
os
.
path
.
exists
(
imp
.
cache_from_source
(
sourcefile
)))
init2fn
=
script_helper
.
make_script
(
pkgdir2
,
'__init__'
,
''
)
bar2fn
=
script_helper
.
make_script
(
pkgdir2
,
'bar2'
,
''
)
self
.
assertRunOK
(
'-q'
,
self
.
pkgdir
,
pkgdir2
)
self
.
assertCompiled
(
self
.
initfn
)
self
.
assertCompiled
(
self
.
barfn
)
self
.
assertCompiled
(
init2fn
)
self
.
assertCompiled
(
bar2fn
)
def
test_d_takes_exactly_one_dir
(
self
):
rc
,
out
,
err
=
self
.
assertRunNotOK
(
'-d'
,
'foo'
)
self
.
assertEqual
(
out
,
b''
)
self
.
assertRegex
(
err
,
b'-d'
)
rc
,
out
,
err
=
self
.
assertRunNotOK
(
'-d'
,
'foo'
,
'bar'
)
self
.
assertEqual
(
out
,
b''
)
self
.
assertRegex
(
err
,
b'-d'
)
def
test_d_compile_error
(
self
):
script_helper
.
make_script
(
self
.
pkgdir
,
'crunchyfrog'
,
'bad(syntax'
)
rc
,
out
,
err
=
self
.
assertRunNotOK
(
'-q'
,
'-d'
,
'dinsdale'
,
self
.
pkgdir
)
self
.
assertRegex
(
out
,
b'File "dinsdale'
)
def
test_d_runtime_error
(
self
):
bazfn
=
script_helper
.
make_script
(
self
.
pkgdir
,
'baz'
,
'raise Exception'
)
self
.
assertRunOK
(
'-q'
,
'-d'
,
'dinsdale'
,
self
.
pkgdir
)
fn
=
script_helper
.
make_script
(
self
.
pkgdir
,
'bing'
,
'import baz'
)
pyc
=
imp
.
cache_from_source
(
bazfn
)
os
.
rename
(
pyc
,
os
.
path
.
join
(
self
.
pkgdir
,
'baz.pyc'
))
os
.
remove
(
bazfn
)
rc
,
out
,
err
=
script_helper
.
assert_python_failure
(
fn
)
self
.
assertRegex
(
err
,
b'File "dinsdale'
)
def
test_include_bad_file
(
self
):
rc
,
out
,
err
=
self
.
assertRunNotOK
(
'-i'
,
os
.
path
.
join
(
self
.
directory
,
'nosuchfile'
),
self
.
pkgdir
)
self
.
assertRegex
(
out
,
b'rror.*nosuchfile'
)
self
.
assertNotRegex
(
err
,
b'Traceback'
)
self
.
assertFalse
(
os
.
path
.
exists
(
imp
.
cache_from_source
(
self
.
pkgdir_cachedir
)))
def
test_include_file_with_arg
(
self
):
f1
=
script_helper
.
make_script
(
self
.
pkgdir
,
'f1'
,
''
)
f2
=
script_helper
.
make_script
(
self
.
pkgdir
,
'f2'
,
''
)
f3
=
script_helper
.
make_script
(
self
.
pkgdir
,
'f3'
,
''
)
f4
=
script_helper
.
make_script
(
self
.
pkgdir
,
'f4'
,
''
)
with
open
(
os
.
path
.
join
(
self
.
directory
,
'l1'
),
'w'
)
as
l1
:
l1
.
write
(
os
.
path
.
join
(
self
.
pkgdir
,
'f1.py'
)
+
os
.
linesep
)
l1
.
write
(
os
.
path
.
join
(
self
.
pkgdir
,
'f2.py'
)
+
os
.
linesep
)
self
.
assertRunOK
(
'-i'
,
os
.
path
.
join
(
self
.
directory
,
'l1'
),
f4
)
self
.
assertCompiled
(
f1
)
self
.
assertCompiled
(
f2
)
self
.
assertNotCompiled
(
f3
)
self
.
assertCompiled
(
f4
)
def
test_include_file_no_arg
(
self
):
f1
=
script_helper
.
make_script
(
self
.
pkgdir
,
'f1'
,
''
)
f2
=
script_helper
.
make_script
(
self
.
pkgdir
,
'f2'
,
''
)
f3
=
script_helper
.
make_script
(
self
.
pkgdir
,
'f3'
,
''
)
f4
=
script_helper
.
make_script
(
self
.
pkgdir
,
'f4'
,
''
)
with
open
(
os
.
path
.
join
(
self
.
directory
,
'l1'
),
'w'
)
as
l1
:
l1
.
write
(
os
.
path
.
join
(
self
.
pkgdir
,
'f2.py'
)
+
os
.
linesep
)
self
.
assertRunOK
(
'-i'
,
os
.
path
.
join
(
self
.
directory
,
'l1'
))
self
.
assertNotCompiled
(
f1
)
self
.
assertCompiled
(
f2
)
self
.
assertNotCompiled
(
f3
)
self
.
assertNotCompiled
(
f4
)
def
test_include_on_stdin
(
self
):
f1
=
script_helper
.
make_script
(
self
.
pkgdir
,
'f1'
,
''
)
f2
=
script_helper
.
make_script
(
self
.
pkgdir
,
'f2'
,
''
)
f3
=
script_helper
.
make_script
(
self
.
pkgdir
,
'f3'
,
''
)
f4
=
script_helper
.
make_script
(
self
.
pkgdir
,
'f4'
,
''
)
p
=
script_helper
.
spawn_python
(
'-m'
,
'compileall'
,
'-i'
,
'-'
)
p
.
stdin
.
write
((
f3
+
os
.
linesep
).
encode
(
'ascii'
))
script_helper
.
kill_python
(
p
)
self
.
assertNotCompiled
(
f1
)
self
.
assertNotCompiled
(
f2
)
self
.
assertCompiled
(
f3
)
self
.
assertNotCompiled
(
f4
)
def
test_compiles_as_much_as_possible
(
self
):
bingfn
=
script_helper
.
make_script
(
self
.
pkgdir
,
'bing'
,
'syntax(error'
)
rc
,
out
,
err
=
self
.
assertRunNotOK
(
'nosuchfile'
,
self
.
initfn
,
bingfn
,
self
.
barfn
)
self
.
assertRegex
(
b'rror'
,
err
)
self
.
assertNotCompiled
(
bingfn
)
self
.
assertCompiled
(
self
.
initfn
)
self
.
assertCompiled
(
self
.
barfn
)
def
test_main
():
def
test_main
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment