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
cd0f7bfd
Commit
cd0f7bfd
authored
13 years ago
by
Tarek Ziade
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #12113: make sure generated module is not reused on a second run
parent
311a2d1b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
Lib/packaging/tests/test_dist.py
Lib/packaging/tests/test_dist.py
+14
-6
No files found.
Lib/packaging/tests/test_dist.py
View file @
cd0f7bfd
...
...
@@ -196,13 +196,16 @@ class DistributionTestCase(support.TempdirManager,
def
test_hooks_get_run
(
self
):
temp_home
=
self
.
mkdtemp
()
module_name
=
os
.
path
.
split
(
temp_home
)[
-
1
]
pyname
=
'%s.py'
%
module_name
config_file
=
os
.
path
.
join
(
temp_home
,
"config1.cfg"
)
hooks_module
=
os
.
path
.
join
(
temp_home
,
"testhooks.py"
)
hooks_module
=
os
.
path
.
join
(
temp_home
,
pyname
)
self
.
write_file
(
config_file
,
textwrap
.
dedent
(
'''
[test_dist]
pre-hook.test = testhooks.log_pre_call
post-hook.test = testhooks.log_post_call'''
))
pre-hook.test = %(modname)s.log_pre_call
post-hook.test = %(modname)s.log_post_call'''
%
{
'modname'
:
module_name
}))
self
.
write_file
(
hooks_module
,
textwrap
.
dedent
(
'''
record = []
...
...
@@ -221,12 +224,17 @@ class DistributionTestCase(support.TempdirManager,
# prepare the call recorders
sys
.
path
.
append
(
temp_home
)
self
.
addCleanup
(
sys
.
path
.
remove
,
temp_home
)
from
testhooks
import
record
record
=
__import__
(
module_name
).
record
old_run
=
cmd
.
run
old_finalize
=
cmd
.
finalize_options
cmd
.
run
=
lambda
:
record
.
append
(
'run'
)
cmd
.
finalize_options
=
lambda
:
record
.
append
(
'finalize'
)
d
.
run_command
(
'test_dist'
)
try
:
d
.
run_command
(
'test_dist'
)
finally
:
cmd
.
run
=
old_run
cmd
.
finalize_options
=
old_finalize
self
.
assertEqual
(
record
,
[
'finalize'
,
'pre-test_dist'
,
...
...
This diff is collapsed.
Click to expand it.
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