Re: pybuild: where to put --test-pytest?

2014-03-15 Thread Barry Warsaw
On Mar 15, 2014, at 12:06 AM, Piotr Ożarowski wrote:

In distutils build plugin, pybuild already checks for test_suite in
setup.py (which apparently is not the only case where 
`{interpreter} setup.py test` should be invoked), invokes
`{interpreter} -m unittest discover -v`... but only for some interpreter
versions or nose/pytest/tox equivalents (which you have enable because,
guess what, it's not that obvious when you can use one instead of the
other).

Please try to convince upstream authors to use ONE AND ONLY ONE
interface.

Sigh.  I've tried.  I've also tried to get the PEP 426, etc. crowd to consider
adding test-specific metadata, but was told that it was off the table for now.
I hope to bring this up again at the upcoming Pycon 2014.  I could use some
allies :).

-Barry


--
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20140315132404.521f3...@limelight.wooz.org



Re: pybuild: where to put --test-pytest?

2014-03-14 Thread Piotr Ożarowski
[Nikolaus Rath, 2014-03-14]
 It seems that pybuild tries to find the tests in some temporary
 directory:
 
 $ debuild -us -uc
 []
 make[1]: Leaving directory `ROOT/python-dugong-2.1'
dh_auto_test -O--buildsystem=pybuild
 I: pybuild base:170: cd ROOT/python-dugong-2.1/.pybuild/pythonX.Y_3.4/build; 
 python3.4 -m pytest 
 = test session starts 
 ==
 platform linux -- Python 3.4.0 -- pytest-2.5.1
 collected 0 items
 [...]
 
 This is presumably because the tests are in ROOT/test, not in
 ROOT/python-dugong-2.1/.pybuild/pythonX.Y_3.4/build. The latter seems to
 contain only the dugong module itself.
 
 Who/what is responsible for copying the tests in this directory? 

how about instead of copying these files, pointing pytest to them?

export PYBUILD_TEST_ARGS={dir}/test/

if you really need to copy them (or invoke 2to3, etc.), you can use
PYBUILD_BEFORE_TEST (or --before-test) to invoke any command before each
test, see `man pybuild` for more info.
-- 
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


-- 
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20140314093920.ga5...@sts0.p1otr.com



Re: pybuild: where to put --test-pytest?

2014-03-14 Thread Nikolaus Rath
Piotr Ożarowski pi...@debian.org writes:
 [Nikolaus Rath, 2014-03-14]
 It seems that pybuild tries to find the tests in some temporary
 directory:
 
 $ debuild -us -uc
 []
 make[1]: Leaving directory `ROOT/python-dugong-2.1'
dh_auto_test -O--buildsystem=pybuild
 I: pybuild base:170: cd ROOT/python-dugong-2.1/.pybuild/pythonX.Y_3.4/build; 
 python3.4 -m pytest 
 = test session starts 
 ==
 platform linux -- Python 3.4.0 -- pytest-2.5.1
 collected 0 items
 [...]
 
 This is presumably because the tests are in ROOT/test, not in
 ROOT/python-dugong-2.1/.pybuild/pythonX.Y_3.4/build. The latter seems to
 contain only the dugong module itself.
 
 Who/what is responsible for copying the tests in this directory? 

 how about instead of copying these files, pointing pytest to them?

I was assuming that there's some rationale for pybuild looking for the
tests in this directory. If they have to be copied there manually, or if
pybuild has to be told to look for them elsewhere, then why look for
them in this weird location in the first place?

It seems to me I'm missing something here.. maybe the right question to
ask is: in what situation would I *not* need to copy the files manually
or modify PYBUILD_TEST_ARGS?


Thanks,
Nikolaus

-- 
Encrypted emails preferred.
PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C

 »Time flies like an arrow, fruit flies like a Banana.«


--
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/878uschic9@rath.org



Re: pybuild: where to put --test-pytest?

2014-03-14 Thread Piotr Ożarowski
 ROOT/python-dugong-2.1/.pybuild/pythonX.Y_3.4/build. The latter seems to
[...]
 I was assuming that there's some rationale for pybuild looking for the
 tests in this directory. If they have to be copied there manually, or if
 pybuild has to be told to look for them elsewhere, then why look for
 them in this weird location in the first place?

Short version: that's a hack to workaround distutils features.
For long version, see distutils/setuptools' sources (and check how it
handles files/locations or parameters from previous steps)

 It seems to me I'm missing something here.. maybe the right question to
 ask is: in what situation would I *not* need to copy the files manually
 or modify PYBUILD_TEST_ARGS?

You don't have to change a thing if unit tests are installed with the
library (f.e. as foo.tests or when all tests are in docstrings).

I just added this to my TODO list:
detect test/tests/unitests directory, copy it to {build_dir}, run 2to3
if needed (this is the tricky part) and add path to this dir in test
plugins that support it

but that's yet another hack, what I'd really want is a *standard*.

In distutils build plugin, pybuild already checks for test_suite in
setup.py (which apparently is not the only case where 
`{interpreter} setup.py test` should be invoked), invokes
`{interpreter} -m unittest discover -v`... but only for some interpreter
versions or nose/pytest/tox equivalents (which you have enable because,
guess what, it's not that obvious when you can use one instead of the
other).

Please try to convince upstream authors to use ONE AND ONLY ONE
interface.
-- 
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


-- 
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20140314230625.gf5...@sts0.p1otr.com



Re: pybuild: where to put --test-pytest?

2014-03-13 Thread Nikolaus Rath
Piotr Ożarowski pi...@debian.org writes:
 [Nikolaus Rath, 2014-03-12]
 I'm working on a package that uses pytest. Conventiently, pybuild seems
 to have a --test-pytest option -- but I'm completely at a loss where to
 put it.
 
 Currently my rules file looks like this:

 you can add this line in debian/rules:

  export PYBUILD_TEST_PYTEST=1

Thanks, this seems to work (documenting this in the pybuild manpage
would be nice).

However, now I have a different problem:

It seems that pybuild tries to find the tests in some temporary
directory:

$ debuild -us -uc
[]
make[1]: Leaving directory `ROOT/python-dugong-2.1'
   dh_auto_test -O--buildsystem=pybuild
I: pybuild base:170: cd ROOT/python-dugong-2.1/.pybuild/pythonX.Y_3.4/build; 
python3.4 -m pytest 
= test session starts ==
platform linux -- Python 3.4.0 -- pytest-2.5.1
collected 0 items
[...]

This is presumably because the tests are in ROOT/test, not in
ROOT/python-dugong-2.1/.pybuild/pythonX.Y_3.4/build. The latter seems to
contain only the dugong module itself.

Who/what is responsible for copying the tests in this directory? 


Thanks,
-Nikolaus

-- 
Encrypted emails preferred.
PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C

 »Time flies like an arrow, fruit flies like a Banana.«


--
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/87k3bx4jyr@vostro.rath.org



Re: pybuild: where to put --test-pytest?

2014-03-12 Thread Piotr Ożarowski
[Nikolaus Rath, 2014-03-12]
 I'm working on a package that uses pytest. Conventiently, pybuild seems
 to have a --test-pytest option -- but I'm completely at a loss where to
 put it.
 
 Currently my rules file looks like this:

you can add this line in debian/rules:

 export PYBUILD_TEST_PYTEST=1

or you can override dh_auto_test:

 override_dh_auto_test:
dh_auto_test -- --test-pytest

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


-- 
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20140312084954.gj22...@sts0.p1otr.com



pybuild: where to put --test-pytest?

2014-03-11 Thread Nikolaus Rath
Hello,

I'm working on a package that uses pytest. Conventiently, pybuild seems
to have a --test-pytest option -- but I'm completely at a loss where to
put it.

Currently my rules file looks like this:

,
| #!/usr/bin/make -f
| # -*- makefile -*-
| 
| #export DH_VERBOSE=1
| export PYBUILD_NAME=dugong
| 
| %:
|   dh $@ --with python3,sphinxdoc --buildsystem=pybuild
| 
| override_dh_auto_build:
|   dh_auto_build
|   python3 setup.py build_sphinx
| 
| override_dh_auto_clean:
|   dh_auto_clean
|   rm -rf doc/html doc/doctrees
`

Where can I sneak in the --test-pytest option?


Thanks,
-Nikolaus

-- 
Encrypted emails preferred.
PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C

 »Time flies like an arrow, fruit flies like a Banana.«


--
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/8761nkvxyt@vostro.rath.org