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

Ximin Luo infinity0 at debian.org
Fri Sep 23 11:54:14 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 5b96bdd1286389842384f387497fca4d9ed609c7
Author: Ximin Luo <infinity0 at debian.org>
Date:   Fri Sep 23 13:44:44 2016 +0200

    Fix and tweak some tests
---
 debian/control                               |  1 +
 debian/patches/debian-binname-coverage.patch | 36 ++++++++++++++++++++++++++++
 debian/patches/series                        |  1 +
 debian/rules                                 |  3 ++-
 tests/tests.py                               | 13 +++++-----
 5 files changed, 47 insertions(+), 7 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/patches/debian-binname-coverage.patch b/debian/patches/debian-binname-coverage.patch
new file mode 100644
index 0000000..2ed6e52
--- /dev/null
+++ b/debian/patches/debian-binname-coverage.patch
@@ -0,0 +1,36 @@
+Description: coverage is python3-coverage in Debian
+Author: Ximin Luo <infinity0 at debian.org>
+Forwarded: not-needed
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+diff --git a/tox.ini b/tox.ini
+index d8e2356..bdbe98a 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 = python3-coverage erase
+ 
+ [testenv:coverage-stats]
+ skip_install = True
+ commands =
+-  coverage combine
+-  coverage report
+-  coverage html
++  python3-coverage combine
++  python3-coverage report
++  python3-coverage html
+ 
+ [testenv]
+ passenv = REPROTEST_TEST_SERVERS
+@@ -24,5 +24,6 @@ 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 = python3-coverage run --omit .tox/* --parallel -m py.test {posargs} tests/tests.py
+ # commands = py.test {posargs} tests/tests.py
++whitelist_externals = python3-coverage
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..09352c6
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+debian-binname-coverage.patch
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

-- 
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