As suggested by Daniel Dickman off-list, I looked at how other projects
deal with tests in py-oauth2.  The only project that actually
distributes tests is NetBSD, and they do it exactly as is done in our
ports right now - placing them to site-packages/tests.[1]  FreeBSD[2],
DragonFly BSD[3], Debian[4] and Gentoo[5] patch "setup.py" to exclude
tests entirely.  (Ubuntu's package also doesn't contain tests, but I
failed to find their sources, so I can't say how exactly they get rid of
it.)  Fedora, Archlinux and OpenSuSE don't have official packages of
this software, but the latter two link to "blessed" unofficial packages,
where tests are removed with "rm -r".

Provided that upstream ceased touching oauth2 in 2011, I believe that
patching tests away in "setup.py" is the most viable long-term solution.

[1] 
http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/pkgsrc/security/py-oauth2/PLIST?rev=1.1.1.1&content-type=text/plain
[2] 
http://svnweb.freebsd.org/ports/head/net/py-oauth2/files/patch-setup.py?revision=348331&view=markup
[3] 
https://github.com/DragonFlyBSD/DPorts/blob/master/net/py-oauth2/files/patch-setup.py
[4] 
http://anonscm.debian.org/viewvc/python-modules/packages/python-oauth2/trunk/debian/patches/exclude_test_module?view=markup
[5] 
https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-python/oauth2/files/oauth2-exclude-tests.patch?view=markup

-- 
Dmitrij D. Czarkoff

Index: Makefile
===================================================================
RCS file: /var/cvs/ports/net/py-oauth2/Makefile,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile
--- Makefile    2 Apr 2015 14:21:16 -0000       1.2
+++ Makefile    28 May 2015 11:18:45 -0000
@@ -5,6 +5,7 @@ COMMENT =       Python library for OAuth
 MODPY_EGG_VERSION = 1.5.211
 DISTNAME =     oauth2-${MODPY_EGG_VERSION}
 PKGNAME =      py-${DISTNAME}
+REVISION =     0
 CATEGORIES =   net
 MAINTAINER =   Johan Huldtgren <[email protected]>
 
@@ -19,5 +20,8 @@ MODULES =     lang/python
 MODPY_SETUPTOOLS = Yes
 
 RUN_DEPENDS =  www/py-httplib2
+TEST_DEPENDS = devel/py-mock \
+               devel/py-coverage \
+               ${RUN_DEPENDS}
 
 .include <bsd.port.mk>
Index: patches/patch-setup_py
===================================================================
RCS file: patches/patch-setup_py
diff -N patches/patch-setup_py
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-setup_py      28 May 2015 20:29:15 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- setup.py.orig      Thu May 28 22:25:46 2015
++++ setup.py   Thu May 28 22:26:16 2015
+@@ -31,7 +31,7 @@ setup(name=PKG,
+       author="Joe Stump",
+       author_email="[email protected]",
+       url="http://github.com/simplegeo/python-oauth2";,
+-      packages = find_packages(),
++      packages = find_packages(exclude=['tests']),
+       install_requires = ['httplib2'],
+       license = "MIT License",
+       keywords="oauth",
Index: pkg/PLIST
===================================================================
RCS file: /var/cvs/ports/net/py-oauth2/pkg/PLIST,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 PLIST
--- pkg/PLIST   31 Oct 2014 11:59:07 -0000      1.1.1.1
+++ pkg/PLIST   28 May 2015 20:26:58 -0000
@@ -18,8 +18,3 @@ lib/python${MODPY_VERSION}/site-packages
 lib/python${MODPY_VERSION}/site-packages/oauth2/clients/imap.pyc
 lib/python${MODPY_VERSION}/site-packages/oauth2/clients/smtp.py
 lib/python${MODPY_VERSION}/site-packages/oauth2/clients/smtp.pyc
-lib/python${MODPY_VERSION}/site-packages/tests/
-lib/python${MODPY_VERSION}/site-packages/tests/__init__.py
-lib/python${MODPY_VERSION}/site-packages/tests/__init__.pyc
-lib/python${MODPY_VERSION}/site-packages/tests/test_oauth.py
-lib/python${MODPY_VERSION}/site-packages/tests/test_oauth.pyc

Reply via email to