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
62c09257
Commit
62c09257
authored
Mar 16, 2013
by
Ezio Melotti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#11420: make test suite pass with -B/DONTWRITEBYTECODE set. Initial patch by Thomas Wouters.
parent
7ae0f03c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
22 deletions
+36
-22
Lib/distutils/tests/test_bdist_dumb.py
Lib/distutils/tests/test_bdist_dumb.py
+3
-2
Lib/test/test_import.py
Lib/test/test_import.py
+10
-3
Lib/test/test_runpy.py
Lib/test/test_runpy.py
+20
-17
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/distutils/tests/test_bdist_dumb.py
View file @
62c09257
...
@@ -87,8 +87,9 @@ class BuildDumbTestCase(support.TempdirManager,
...
@@ -87,8 +87,9 @@ class BuildDumbTestCase(support.TempdirManager,
fp
.
close
()
fp
.
close
()
contents
=
sorted
(
os
.
path
.
basename
(
fn
)
for
fn
in
contents
)
contents
=
sorted
(
os
.
path
.
basename
(
fn
)
for
fn
in
contents
)
wanted
=
[
'foo-0.1-py%s.%s.egg-info'
%
sys
.
version_info
[:
2
],
wanted
=
[
'foo-0.1-py%s.%s.egg-info'
%
sys
.
version_info
[:
2
],
'foo.py'
]
'foo.py'
,
'foo.pyc'
]
if
not
sys
.
dont_write_bytecode
:
wanted
.
append
(
'foo.pyc'
)
self
.
assertEqual
(
contents
,
sorted
(
wanted
))
self
.
assertEqual
(
contents
,
sorted
(
wanted
))
def
test_finalize_options
(
self
):
def
test_finalize_options
(
self
):
...
...
Lib/test/test_import.py
View file @
62c09257
...
@@ -88,7 +88,8 @@ class ImportTests(unittest.TestCase):
...
@@ -88,7 +88,8 @@ class ImportTests(unittest.TestCase):
unlink
(
source
)
unlink
(
source
)
try
:
try
:
imp
.
reload
(
mod
)
if
not
sys
.
dont_write_bytecode
:
imp
.
reload
(
mod
)
except
ImportError
,
err
:
except
ImportError
,
err
:
self
.
fail
(
"import from .pyc/.pyo failed: %s"
%
err
)
self
.
fail
(
"import from .pyc/.pyo failed: %s"
%
err
)
finally
:
finally
:
...
@@ -105,7 +106,10 @@ class ImportTests(unittest.TestCase):
...
@@ -105,7 +106,10 @@ class ImportTests(unittest.TestCase):
finally
:
finally
:
del
sys
.
path
[
0
]
del
sys
.
path
[
0
]
@
unittest
.
skipUnless
(
os
.
name
==
'posix'
,
"test meaningful only on posix systems"
)
@
unittest
.
skipUnless
(
os
.
name
==
'posix'
,
"test meaningful only on posix systems"
)
@
unittest
.
skipIf
(
sys
.
dont_write_bytecode
,
"test meaningful only when writing bytecode"
)
def
test_execute_bit_not_copied
(
self
):
def
test_execute_bit_not_copied
(
self
):
# Issue 6070: under posix .pyc files got their execute bit set if
# Issue 6070: under posix .pyc files got their execute bit set if
# the .py file had the execute bit set, but they aren't executable.
# the .py file had the execute bit set, but they aren't executable.
...
@@ -132,6 +136,8 @@ class ImportTests(unittest.TestCase):
...
@@ -132,6 +136,8 @@ class ImportTests(unittest.TestCase):
unload
(
TESTFN
)
unload
(
TESTFN
)
del
sys
.
path
[
0
]
del
sys
.
path
[
0
]
@
unittest
.
skipIf
(
sys
.
dont_write_bytecode
,
"test meaningful only when writing bytecode"
)
def
test_rewrite_pyc_with_read_only_source
(
self
):
def
test_rewrite_pyc_with_read_only_source
(
self
):
# Issue 6074: a long time ago on posix, and more recently on Windows,
# Issue 6074: a long time ago on posix, and more recently on Windows,
# a read only source file resulted in a read only pyc file, which
# a read only source file resulted in a read only pyc file, which
...
@@ -441,7 +447,8 @@ func_filename = func.func_code.co_filename
...
@@ -441,7 +447,8 @@ func_filename = func.func_code.co_filename
self
.
assertEqual
(
mod
.
func_filename
,
self
.
file_name
)
self
.
assertEqual
(
mod
.
func_filename
,
self
.
file_name
)
del
sys
.
modules
[
self
.
module_name
]
del
sys
.
modules
[
self
.
module_name
]
mod
=
self
.
import_module
()
mod
=
self
.
import_module
()
self
.
assertEqual
(
mod
.
module_filename
,
self
.
compiled_name
)
if
not
sys
.
dont_write_bytecode
:
self
.
assertEqual
(
mod
.
module_filename
,
self
.
compiled_name
)
self
.
assertEqual
(
mod
.
code_filename
,
self
.
file_name
)
self
.
assertEqual
(
mod
.
code_filename
,
self
.
file_name
)
self
.
assertEqual
(
mod
.
func_filename
,
self
.
file_name
)
self
.
assertEqual
(
mod
.
func_filename
,
self
.
file_name
)
...
...
Lib/test/test_runpy.py
View file @
62c09257
...
@@ -170,11 +170,12 @@ class RunModuleTest(unittest.TestCase):
...
@@ -170,11 +170,12 @@ class RunModuleTest(unittest.TestCase):
del
d1
# Ensure __loader__ entry doesn't keep file open
del
d1
# Ensure __loader__ entry doesn't keep file open
__import__
(
mod_name
)
__import__
(
mod_name
)
os
.
remove
(
mod_fname
)
os
.
remove
(
mod_fname
)
if
verbose
:
print
"Running from compiled:"
,
mod_name
if
not
sys
.
dont_write_bytecode
:
d2
=
run_module
(
mod_name
)
# Read from bytecode
if
verbose
:
print
"Running from compiled:"
,
mod_name
self
.
assertIn
(
"x"
,
d2
)
d2
=
run_module
(
mod_name
)
# Read from bytecode
self
.
assertTrue
(
d2
[
"x"
]
==
1
)
self
.
assertIn
(
"x"
,
d2
)
del
d2
# Ensure __loader__ entry doesn't keep file open
self
.
assertTrue
(
d2
[
"x"
]
==
1
)
del
d2
# Ensure __loader__ entry doesn't keep file open
finally
:
finally
:
self
.
_del_pkg
(
pkg_dir
,
depth
,
mod_name
)
self
.
_del_pkg
(
pkg_dir
,
depth
,
mod_name
)
if
verbose
:
print
"Module executed successfully"
if
verbose
:
print
"Module executed successfully"
...
@@ -192,11 +193,12 @@ class RunModuleTest(unittest.TestCase):
...
@@ -192,11 +193,12 @@ class RunModuleTest(unittest.TestCase):
del
d1
# Ensure __loader__ entry doesn't keep file open
del
d1
# Ensure __loader__ entry doesn't keep file open
__import__
(
mod_name
)
__import__
(
mod_name
)
os
.
remove
(
mod_fname
)
os
.
remove
(
mod_fname
)
if
verbose
:
print
"Running from compiled:"
,
pkg_name
if
not
sys
.
dont_write_bytecode
:
d2
=
run_module
(
pkg_name
)
# Read from bytecode
if
verbose
:
print
"Running from compiled:"
,
pkg_name
self
.
assertIn
(
"x"
,
d2
)
d2
=
run_module
(
pkg_name
)
# Read from bytecode
self
.
assertTrue
(
d2
[
"x"
]
==
1
)
self
.
assertIn
(
"x"
,
d2
)
del
d2
# Ensure __loader__ entry doesn't keep file open
self
.
assertTrue
(
d2
[
"x"
]
==
1
)
del
d2
# Ensure __loader__ entry doesn't keep file open
finally
:
finally
:
self
.
_del_pkg
(
pkg_dir
,
depth
,
pkg_name
)
self
.
_del_pkg
(
pkg_dir
,
depth
,
pkg_name
)
if
verbose
:
print
"Package executed successfully"
if
verbose
:
print
"Package executed successfully"
...
@@ -246,13 +248,14 @@ from ..uncle.cousin import nephew
...
@@ -246,13 +248,14 @@ from ..uncle.cousin import nephew
del
d1
# Ensure __loader__ entry doesn't keep file open
del
d1
# Ensure __loader__ entry doesn't keep file open
__import__
(
mod_name
)
__import__
(
mod_name
)
os
.
remove
(
mod_fname
)
os
.
remove
(
mod_fname
)
if
verbose
:
print
"Running from compiled:"
,
mod_name
if
not
sys
.
dont_write_bytecode
:
d2
=
run_module
(
mod_name
,
run_name
=
run_name
)
# Read from bytecode
if
verbose
:
print
"Running from compiled:"
,
mod_name
self
.
assertIn
(
"__package__"
,
d2
)
d2
=
run_module
(
mod_name
,
run_name
=
run_name
)
# Read from bytecode
self
.
assertTrue
(
d2
[
"__package__"
]
==
pkg_name
)
self
.
assertIn
(
"__package__"
,
d2
)
self
.
assertIn
(
"sibling"
,
d2
)
self
.
assertTrue
(
d2
[
"__package__"
]
==
pkg_name
)
self
.
assertIn
(
"nephew"
,
d2
)
self
.
assertIn
(
"sibling"
,
d2
)
del
d2
# Ensure __loader__ entry doesn't keep file open
self
.
assertIn
(
"nephew"
,
d2
)
del
d2
# Ensure __loader__ entry doesn't keep file open
finally
:
finally
:
self
.
_del_pkg
(
pkg_dir
,
depth
,
mod_name
)
self
.
_del_pkg
(
pkg_dir
,
depth
,
mod_name
)
if
verbose
:
print
"Module executed successfully"
if
verbose
:
print
"Module executed successfully"
...
...
Misc/NEWS
View file @
62c09257
...
@@ -818,6 +818,9 @@ Extension Modules
...
@@ -818,6 +818,9 @@ Extension Modules
Tests
Tests
-----
-----
-
Issue
#
11420
:
make
test
suite
pass
with
-
B
/
DONTWRITEBYTECODE
set
.
Initial
patch
by
Thomas
Wouters
.
-
Issue
#
17299
:
Add
test
coverage
for
cPickle
with
file
objects
and
general
IO
-
Issue
#
17299
:
Add
test
coverage
for
cPickle
with
file
objects
and
general
IO
objects
.
Original
patch
by
Aman
Shah
.
objects
.
Original
patch
by
Aman
Shah
.
...
...
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