Re: Help with pytest 2.8.5

2015-12-17 Thread Barry Warsaw
Thanks for the suggestions Tristan & Piotr,

On Dec 17, 2015, at 01:15 PM, Piotr Ożarowski wrote:

>> 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 
>> ; \
>
>PYTHONPATH=$(CURDIR) part looks very suspicious (and error prone)
>
>> done
>>  endif
>
>I didn't test it but... why is override_dh_auto_test needed at all?
>Did you try with:
>
>  export PYBUILD_TEST_ARGS={dir}/testing
>
>?
>(only "test" or "tests" are copied to build dir by default, you need to
>pass path to directory with tests if they're in non standard location)

I did try various riffs on this theme, but am still unable to get
tests_genscript.py to pass.  FWIW, here's the current pybuild-based rule:

# 2015-12-16 ba...@debian.org: Because pytest does not clean up after itself,
# use a custom temporary directory (which is easier to clean up manually,
# e.g. in an sbuild).
override_dh_auto_test:
TMPDIR=`mktemp -t -d pytest.XX` \
PYBUILD_SYSTEM=custom \
PYTHONPATH=$$(CURDIR) \
PYBUILD_TEST_ARGS="{interpreter} -m pytest --lsof -rfsxX {dir}/testing" 
dh_auto_test

Don't worry about the style of the above unless it's material to the failure.
As I mentioned, I've tried lots of different variations.  None allow
test_genscript.py to pass.  (Setting or not PYTHONPATH also makes no
difference.)

I believe genscript is deprecated in pytest, so I'm seriously considering just
disabling this test for now and moving on.

Cheers,
-Barry



Re: Help with pytest 2.8.5

2015-12-17 Thread Tristan Seligmann
On Thu, 17 Dec 2015, 14:16 Piotr Ożarowski  wrote:

>
> I didn't test it but... why is override_dh_auto_test needed at all?
> Did you try with:
>

Ah sorry, my diff was against the old debian/rules which didn't use
pybuild.

However the same problem may happen if pybuild chdir()s to the build
directory (I don't remember offhand what it does, and I'm not at my
computer).


Re: Help with pytest 2.8.5

2015-12-17 Thread Piotr Ożarowski
> 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 ; 
> \

PYTHONPATH=$(CURDIR) part looks very suspicious (and error prone)

> done
>  endif

I didn't test it but... why is override_dh_auto_test needed at all?
Did you try with:

  export PYBUILD_TEST_ARGS={dir}/testing

?
(only "test" or "tests" are copied to build dir by default, you need to
pass path to directory with tests if they're in non standard location)
-- 
Piotr Ożarowski Debian GNU/Linux Developer
www.ozarowski.pl  www.griffith.cc   www.debian.org
GPG Fingerprint: 1D2F A898 58DA AF62 1786 2DF7 AEF6 F1A2 A745 7645



Re: Help with pytest 2.8.5

2015-12-17 Thread Tristan Seligmann
On Thu, 17 Dec 2015 at 02:17 Barry Warsaw  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