[pacman-dev] [PATCH 1/8] Restore ability to run tests with version 2.5 of Python.
scalaprotractor at gmail.com
Wed Oct 9 20:35:04 EDT 2013
Running the tests with various Python versions revealed that exactly
one 2.6 feature had been introduced: sys.maxsize was used in the
"query006" test. Now it uses sys.maxsize where available and falls
back to use sys.maxint.
Note that the test function is not affected at all. The only possible
consequence of this change is that the test might not be flagged as
expected to fail, and thus "TODO" might not be appended to the failure
message. The only effect would be to overstate the severity of a
failure on this test. And this could only happen in environments where
(without this patch) the test would crash the whole pactest framework
with an AttributeError.
The "mode001" test was running but indicated a failure on the 2.5
runtime. Package tars built by the pactest framework on that runtime
had permissions set to 0666 for files (instead of 0644) when the
caller failed to explicitly set that field in the TarInfo.
With this patch the tests were run by the author with these Python
versions: 2.5.6, 2.6.8 and 2.7.5. On all those runtimes these five
tests (all marked expected to fail) failed: query006, replace110,
sync403, sync406, upgrade078. And all other tests passed.
What does this accomplish? By itself, not much. Obviously nobody is
using 2.5, or if they are they haven't mentioned the AttributeError.
And nobody is going to start. But it sets up a test of the testing
framework for the sequence of commits to follow. Having extended the
range of runtimes back to 2.5, the next several commits aim to extend
it forward without breaking anything for these older runtimes.
Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com>
test/pacman/pmpkg.py | 2 ++
test/pacman/tests/query006.py | 3 +--
test/pacman/util.py | 9 +++++++++
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/test/pacman/pmpkg.py b/test/pacman/pmpkg.py
index 9b3147a..c60f11b 100644
@@ -162,6 +162,8 @@ def makepkg(self, path):
info.mode = fileinfo["perms"]
info.mode = 0755
+ elif not fileinfo["islink"]:
+ info.mode = 0644
info.type = tarfile.DIRTYPE
diff --git a/test/pacman/tests/query006.py b/test/pacman/tests/query006.py
index 0f6f762..ed7ac40 100644
@@ -25,6 +25,5 @@
self.addrule("PACMAN_OUTPUT=^Install Date.* 2286")
# expect failure on 32bit systems
-if sys.maxsize <= 2**32:
+if util.sys_maxsize <= 2**32:
self.expectfailure = True
diff --git a/test/pacman/util.py b/test/pacman/util.py
index 14035d7..62f88f9 100644
@@ -19,6 +19,7 @@
@@ -47,6 +48,14 @@ def vprint(msg):
+# Python version sensitive stuff
+sys_maxsize = sys.maxsize if sys.hexversion >= 0x02060000 else sys.maxint
# Methods to generate files
More information about the pacman-dev