[reprotest] 01/01: Fix and tweak some tests

Ximin Luo infinity0 at debian.org
Fri Sep 23 13:46:41 UTC 2016


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository reprotest.

commit 7058e3aec6f2c64fd9cac87762409f679d36cbad
Author: Ximin Luo <infinity0 at debian.org>
Date:   Fri Sep 23 15:44:44 2016 +0200

    Fix and tweak some tests
---
 debian/control |  1 +
 debian/rules   |  3 ++-
 tests/tests.py | 13 +++++++------
 tox.ini        | 10 +++++-----
 4 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/debian/control b/debian/control
index 9e1b126..f69f746 100644
--- a/debian/control
+++ b/debian/control
@@ -26,6 +26,7 @@ Depends: ${python3:Depends},
  apt-utils,
  libdpkg-perl,
  procps,
+ python3-pkg-resources,
  diffoscope,
  ${misc:Depends}
 Recommends: autodep8, schroot, qemu-system, qemu-utils, disorderfs, locales-all
diff --git a/debian/rules b/debian/rules
index dbd3719..3e5aeec 100755
--- a/debian/rules
+++ b/debian/rules
@@ -8,5 +8,6 @@ export PYBUILD_NAME = reprotest
 
 override_dh_auto_test:
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
-	REPROTEST_TEST_SERVERS=null tox -- -s
+# FIXME: doesn't work on pbuilder atm, tox wants network even with --sitepackages for some reason >:[
+	REPROTEST_TEST_SERVERS=null tox -r --sitepackages -- -s
 endif
diff --git a/tests/tests.py b/tests/tests.py
index bc43f87..4104beb 100755
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -4,13 +4,10 @@
 import os
 import subprocess
 
-import pkg_resources
 import pytest
 
 import reprotest
 
-VERSION = pkg_resources.require('reprotest')[0].version
-
 def check_return_code(command, virtual_server, code):
     try:
         retcode = reprotest.check(command, 'artifact', virtual_server, 'tests')
@@ -31,7 +28,9 @@ def virtual_server(request):
         raise ValueError(request.param)
 
 def test_simple_builds(virtual_server):
-    check_return_code('python3 mock_build.py', virtual_server, 0)
+    # mock_build is not expected to reproduce when disorderfs is active, though
+    # we should probably change "1" to int(is_disorderfs_active)
+    check_return_code('python3 mock_build.py', virtual_server, 1)
     check_return_code('python3 mock_failure.py', virtual_server, 2)
     check_return_code('python3 mock_build.py irreproducible', virtual_server, 1)
 
@@ -40,16 +39,18 @@ def test_variations(virtual_server, variation):
     check_return_code('python3 mock_build.py ' + variation, virtual_server, 1)
 
 def test_self_build(virtual_server):
-    assert(subprocess.call(['reprotest', 'python3 setup.py bdist', 'dist/reprotest-' + VERSION + '.linux-x86_64.tar.gz'] + virtual_server) == 1)
+    assert(1 == subprocess.call(['reprotest', 'python3 setup.py bdist', 'dist/*.tar.gz'] + virtual_server))
     # at time of writing (2016-09-23) these are not expected to reproduce;
     # strip-nondeterminism normalises them for Debian
     assert(1 == subprocess.call(['reprotest', 'python3 setup.py sdist 2>/dev/null', 'dist/*.tar.gz'] + virtual_server))
     assert(1 == subprocess.call(['reprotest', 'python3 setup.py bdist_wheel', 'dist/*.whl'] + virtual_server))
+
+# TODO: don't call it if we don't have debian/, e.g. for other distros
+def test_debian_build(virtual_server):
     # This is a bit dirty though it works - when building the debian package,
     # debian/rules will call this, which will call debian/rules, so ../*.deb
     # gets written twice and the second one is the "real" one, but since it
     # should all be reproducible, this should be OK.
-    # TODO: don't call it if we don't have debian/, e.g. for other distros
     assert(0 == subprocess.call(
         ['reprotest', 'debuild -b -uc -us', '../*.deb'] + virtual_server,
         # "nocheck" to stop tests recursing into themselves
diff --git a/tox.ini b/tox.ini
index d8e2356..2610b80 100644
--- a/tox.ini
+++ b/tox.ini
@@ -5,14 +5,14 @@ skip_missing_interpreters = true
 
 [testenv:coverage-clean]
 skip_install = True
-commands = coverage erase
+commands = {envpython} -m coverage erase
 
 [testenv:coverage-stats]
 skip_install = True
 commands =
-  coverage combine
-  coverage report
-  coverage html
+  {envpython} -m coverage combine
+  {envpython} -m coverage report
+  {envpython} -m coverage html
 
 [testenv]
 passenv = REPROTEST_TEST_SERVERS
@@ -24,5 +24,5 @@ deps =
 #  pytest-cov
   pytest
 # commands = py.test --cov-report html --cov=reprotest tests/tests.py
-commands = coverage run --omit .tox/* --parallel -m py.test {posargs} tests/tests.py
+commands = {envpython} -m coverage run --omit .tox/* --parallel -m py.test {posargs} tests/tests.py
 # commands = py.test {posargs} tests/tests.py

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/reprotest.git



More information about the Reproducible-commits mailing list