[med-svn] [Git][med-team/python-schema-salad][master] Fix the already shipped tests and enable them as autopkgtests.

Michael R. Crusoe gitlab at salsa.debian.org
Fri Jan 4 14:45:48 GMT 2019


Michael R. Crusoe pushed to branch master at Debian Med / python-schema-salad


Commits:
71279ade by Michael R. Crusoe at 2019-01-04T14:45:42Z
Fix the already shipped tests and enable them as autopkgtests.

- - - - -


6 changed files:

- debian/changelog
- debian/control
- debian/patches/exec_cwl
- debian/rules
- + debian/tests/control
- + debian/tests/run-tests


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+python-schema-salad (3.0.20181206233650-2) unstable; urgency=medium
+
+  * Fix the already shipped tests and enable them as autopkgtests.
+  * Run the same tests at compile time.
+
+ -- Michael R. Crusoe <michael.crusoe at gmail.com>  Fri, 04 Jan 2019 06:45:22 -0800
+
 python-schema-salad (3.0.20181206233650-1) unstable; urgency=medium
 
   * New upstream version


=====================================
debian/control
=====================================
@@ -2,7 +2,6 @@ Source: python-schema-salad
 Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.org>
 Uploaders: Michael R. Crusoe <michael.crusoe at gmail.com>
 Section: python
-Testsuite: autopkgtest-pkg-python
 Priority: optional
 Build-Depends: debhelper (>= 11~),
                dh-python,
@@ -18,6 +17,8 @@ Build-Depends: debhelper (>= 11~),
                python3-cachecontrol,
                python3-lockfile,
                python3-typing-extensions,
+	       python3-pytest-xdist,
+	       python3-pytest-runner,
                help2man
 Standards-Version: 4.3.0
 Vcs-Browser: https://salsa.debian.org/med-team/python-schema-salad


=====================================
debian/patches/exec_cwl
=====================================
@@ -285,3 +285,61 @@ Subject: Add proper "#!" header to all CWL files
 -    out: [out]
 \ No newline at end of file
 +    out: [out]
+--- schema-salad.orig/schema_salad/tests/test_print_oneline.py
++++ schema-salad/schema_salad/tests/test_print_oneline.py
+@@ -46,7 +46,7 @@
+             except RuntimeError as e:
+                 msg = reformat_yaml_exception_message(strip_dup_lineno(six.text_type(e)))
+                 msg = to_one_line_messages(msg)
+-                self.assertTrue(msg.endswith(src+":10:1: could not find expected \':\'"))
++                self.assertTrue(msg.endswith(src+":11:1: could not find expected \':\'"))
+                 print("\n", e)
+                 raise
+ 
+@@ -62,10 +62,9 @@
+                                   six.text_type(get_data("tests/test_schema/"+src)), True)
+             except ValidationException as e:
+                 msgs = to_one_line_messages(str(e)).splitlines()
+-                self.assertEqual(len(msgs), 3)
+-                self.assertTrue(msgs[0].endswith(src+":9:1: the `outputs` field is not valid because"))
+-                self.assertTrue(msgs[1].endswith(src+":13:5: missing required field `id`"))
+-                self.assertTrue(msgs[2].endswith(src+":13:5: invalid field `aa`, expected one of: 'label', 'secondaryFiles', 'format', 'streamable', 'doc', 'id', 'outputBinding', 'type'"))
++                assert len(msgs) == 2, msgs
++                self.assertTrue(msgs[0].endswith(src+":14:5: missing required field `id`"))
++                self.assertTrue(msgs[1].endswith(src+":14:5: invalid field `aa`, expected one of: 'label', 'secondaryFiles', 'format', 'streamable', 'doc', 'id', 'outputBinding', 'type'"))
+                 print("\n", e)
+                 raise
+ 
+@@ -88,9 +87,9 @@
+                 self.assertEqual(len(msgs), 2)
+                 print("\n", e)
+                 assert msgs[0].endswith(
+-                    src + ':8:1: checking field `outputs`')
++                    src + ':9:1: checking field `outputs`')
+                 assert msgs[1].endswith(
+-                    src + ':13:5: Field `type` references unknown identifier '
++                    src + ':14:5: Field `type` references unknown identifier '
+                     '`Filea`, tried file://%s#Filea' % (fullpath))
+                 raise
+ 
+@@ -108,8 +107,8 @@
+                 msg = reformat_yaml_exception_message(strip_dup_lineno(six.text_type(e)))
+                 msgs = msg.splitlines()
+                 self.assertEqual(len(msgs), 2)
+-                self.assertTrue(msgs[0].endswith(src+":9:7: while scanning a simple key"))
+-                self.assertTrue(msgs[1].endswith(src+":10:1:   could not find expected ':'"))
++                self.assertTrue(msgs[0].endswith(src+":10:7: while scanning a simple key"))
++                self.assertTrue(msgs[1].endswith(src+":11:1:   could not find expected ':'"))
+                 print("\n", e)
+                 raise
+ 
+@@ -125,7 +124,7 @@
+                                   six.text_type(get_data("tests/test_schema/"+src)), True)
+             except RuntimeError as e:
+                 msg = reformat_yaml_exception_message(strip_dup_lineno(six.text_type(e)))
+-                self.assertTrue(msg.endswith(src+":1:1: expected <block end>, but found ':'")
+-                                or msg.endswith(src+":1:1: expected <block end>, but found u':'"))
++                self.assertTrue(msg.endswith(src+":2:1: expected <block end>, but found ':'")
++                                or msg.endswith(src+":2:1: expected <block end>, but found u':'"))
+                 print("\n", e)
+                 raise


=====================================
debian/rules
=====================================
@@ -5,7 +5,7 @@ DH_VERBOSE := 1
 include /usr/share/dpkg/pkg-info.mk
 
 export PYBUILD_NAME=schema-salad
-export PYBUILD_DISABLE=test
+#export PYBUILD_DISABLE=test
 
 %:
 	dh $@ --with python3 --buildsystem=pybuild
@@ -32,6 +32,15 @@ override_dh_auto_build:
 	sed -i 's/PYTHON/SCHEMA-SALAD-DOC/g' debian/schema-salad-doc.1
 	find . -name "*.coverage" -delete
 
+override_dh_auto_test:
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+	dh_auto_install
+	PYBUILD_SYSTEM=custom \
+	PYBUILD_TEST_ARGS="cd {dir}; export PATH={destdir}/usr/bin:$$PATH ; \
+	cd {build_dir}; export PYTHONPATH=$$(pwd); python3 -m pytest \
+		-n auto --dist=loadfile --pyarg schema_salad" dh_auto_test
+endif
+
 override_dh_auto_install:
 	dh_auto_install
 	find debian -name LICENSE -delete


=====================================
debian/tests/control
=====================================
@@ -0,0 +1,3 @@
+Tests: run-tests
+Depends: @, python3-pytest-xdist
+Restrictions: allow-stderr


=====================================
debian/tests/run-tests
=====================================
@@ -0,0 +1,8 @@
+#!/bin/sh -e
+
+pkg=packagename
+if [ "$ADTTMP" = "" ] ; then
+	ADTTMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
+fi
+cd "$ADTTMP"
+py.test-3 --numprocesses=auto --dist=loadfile --pyarg schema_salad



View it on GitLab: https://salsa.debian.org/med-team/python-schema-salad/commit/71279adec1ef847eeeaea4e11f93afe71bb22e8b

-- 
View it on GitLab: https://salsa.debian.org/med-team/python-schema-salad/commit/71279adec1ef847eeeaea4e11f93afe71bb22e8b
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20190104/c610efb4/attachment-0001.html>


More information about the debian-med-commit mailing list