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


Help with pytest 2.8.5

2015-12-16 Thread Barry Warsaw
I've been working on an update to pytest 2.8.5, but I'm stuck and I'm hoping
someone here can help.  The DPMT git repo is up-to-date with my latest work if
you'd like to check the branches out and try to debug the builds.

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

I've tried running the tests via tox and directly invoking the tox.ini
command, as you'll see in the current d/rules file.  I'm at a loss, but then
pytest's output has always boggled me.  FWIW, when I run tox in the upstream
repo from the 2.8.5 tag, it works just fine.  There's something about the
build environment that's breaking the test suite, but I can't figure it out.

Note too that pytest does not seem to clean up properly after itself, thus the
mktemp in d/rules.  That at least makes it a little easier to clean up the /tmp
directories after an unsucessful sbuild.

I also added a DEP-8 test but haven't been able to get that working either.

Please, if you want to see pytest 2.8.5 in Debian, give it a look.  All help
and suggestions welcome.

Cheers,
-Barry


pgp3h6GSVOh4c.pgp
Description: OpenPGP digital signature