[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Help with pytest 2.8.5



On Thu, 17 Dec 2015 at 02:17 Barry Warsaw <barry@debian.org> wrote:

I've made some significant changes to the packaging by switching it to
pybuild.  That's not the problem though. ;)  The problem is that I can't get
the test suite to run cleanly during package build.  I'm seeing two failures
in testing/test_genscript.py which causes the build to fail (or, if I ignore
that, prevents pybuild from running the test for Python 3.4 and 3.5).

The failures in test_genscript are due to running the tests from the source directory; this causes the sources (in particular, _pytest.standalonetemplate) to be imported with relative paths, which are then no longer correct once pytest chdir()s to a temporary directory during the test run.

I attached a patch which illustrates how to fix the problem.

There is one other test failure, a failing doctest in testing/cx_freeze/tests/test_doctest.txt; this is a result of the 2.8.5 sdist being prepared on Windows, causing all of the source files to have "dos" (CRLF) line endings instead of "unix" (LF) line endings. I'm not sure exactly what the best way to fix this is, but I guess a patch to change the line-endings in the file should do the trick.
diff --git a/debian/rules b/debian/rules
index f473395..3c2f918 100755
--- a/debian/rules
+++ b/debian/rules
@@ -59,8 +59,9 @@ override_dh_clean:
 override_dh_auto_test:
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
        set -ex; \
+       cd /tmp; \
        for py in $(PYVERS) $(PY3VERS); do \
-               PYTHONPATH=$(CURDIR) python$$py -m pytest testing ; \
+               PYTHONPATH=$(CURDIR) python$$py -m pytest $(CURDIR)/testing ; \
        done
 endif

Reply to: