python-pgpdump icon indicating copy to clipboard operation
python-pgpdump copied to clipboard

setup.py missing test_suite support

Open eighthave opened this issue 13 years ago • 5 comments

The setup.py file does not include the test script. That is the standard interface for running the tests, and means that things that wrap setup.py will automatically run the tests. Such things include Debian packaging, pip, etc.

This patch adds test support while maintaining distutils compatibility:

diff --git a/setup.py b/setup.py
index 4bbca27..fc7eed2 100644
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,7 @@
-from distutils.core import setup
+try:
+    from setuptools import setup
+except ImportError:
+    from distutils.core import setup

 from pgpdump import __version__, __author__

@@ -21,5 +24,6 @@ setup(
     url = 'https://github.com/toofishes/python-pgpdump',
     keywords = 'pgp gpg rfc2440 rfc4880 crypto cryptography',
     classifiers = classifiers,
-    packages = ['pgpdump']
+    packages = ['pgpdump'],
+    test_suite='pgpdump.test'
 )

eighthave avatar Oct 19 '12 01:10 eighthave

How do most other packages handle this? This warning is rather annoying:

$ python2 setup.py check
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'test_suite'
  warnings.warn(msg)

toofishes avatar Oct 22 '12 15:10 toofishes

I haven't found a very clear standard in the way that people are incorporating tests. There is a pure distutils approach that I've seen, but it looked a lot more complicated. So I've used this approach. Having setuptools installed makes the warning go away.

eighthave avatar Oct 22 '12 15:10 eighthave

Fyi, @eighthave is creating a python-pgpdump package in Debian, hence this ;)

abeluck avatar Oct 23 '12 14:10 abeluck

its done and already in Debian: http://packages.qa.debian.org/p/python-pgpdump.html :-D

eighthave avatar Oct 23 '12 14:10 eighthave

I'd like this to be merged as well, or at least something comparable to make it straightforward to run the tests in a standard way.

dkg avatar Sep 15 '19 01:09 dkg