[Python-checkins] cpython: Minor tweak to packaging tests.

eric.araujo python-checkins at python.org
Mon Nov 7 18:11:41 CET 2011


http://hg.python.org/cpython/rev/01f3cd004860
changeset:   73424:01f3cd004860
user:        Éric Araujo <merwok at netwok.org>
date:        Sun Nov 06 10:48:55 2011 +0100
summary:
  Minor tweak to packaging tests.

When an option is changed on a command object, calling ensure_finalized
for a second time will not run finalize_options again, because
ensure_finalized is a no-op the second time.  By resetting the finalized
attribute, we can be sure that whatever computation takes place in
finalize_options will happen again.

(In test_command_clean, I removed two lines that were a no-op.)

files:
  Lib/packaging/tests/test_command_clean.py        |  2 --
  Lib/packaging/tests/test_command_install_data.py |  2 ++
  Lib/packaging/tests/test_command_register.py     |  1 +
  Lib/packaging/tests/test_command_sdist.py        |  2 +-
  4 files changed, 4 insertions(+), 3 deletions(-)


diff --git a/Lib/packaging/tests/test_command_clean.py b/Lib/packaging/tests/test_command_clean.py
--- a/Lib/packaging/tests/test_command_clean.py
+++ b/Lib/packaging/tests/test_command_clean.py
@@ -36,8 +36,6 @@
                              '%r was not removed' % path)
 
         # let's run the command again (should spit warnings but succeed)
-        cmd.all = True
-        cmd.ensure_finalized()
         cmd.run()
 
 
diff --git a/Lib/packaging/tests/test_command_install_data.py b/Lib/packaging/tests/test_command_install_data.py
--- a/Lib/packaging/tests/test_command_install_data.py
+++ b/Lib/packaging/tests/test_command_install_data.py
@@ -62,6 +62,7 @@
 
         # let's try with warn_dir one
         cmd.warn_dir = True
+        cmd.finalized = False
         cmd.ensure_finalized()
         cmd.run()
 
@@ -80,6 +81,7 @@
 
         cmd.data_files = {one: '{inst}/one', two: '{inst2}/two',
                           three: '{inst3}/three'}
+        cmd.finalized = False
         cmd.ensure_finalized()
         cmd.run()
 
diff --git a/Lib/packaging/tests/test_command_register.py b/Lib/packaging/tests/test_command_register.py
--- a/Lib/packaging/tests/test_command_register.py
+++ b/Lib/packaging/tests/test_command_register.py
@@ -143,6 +143,7 @@
 
         register_module.input = _no_way
         cmd.show_response = True
+        cmd.finalized = False
         cmd.ensure_finalized()
         cmd.run()
 
diff --git a/Lib/packaging/tests/test_command_sdist.py b/Lib/packaging/tests/test_command_sdist.py
--- a/Lib/packaging/tests/test_command_sdist.py
+++ b/Lib/packaging/tests/test_command_sdist.py
@@ -140,7 +140,7 @@
 
         # now trying a tar then a gztar
         cmd.formats = ['tar', 'gztar']
-
+        cmd.finalized = False
         cmd.ensure_finalized()
         cmd.run()
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list