[Pkg-privacy-commits] [pyptlib] 134/136: Rewrite autopkgtest script
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 13:25:19 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository pyptlib.
commit b0bfc1dd9aaf8ce0fe9b58e7ad3c55bf057318af
Author: Jérémy Bobbio <lunar at debian.org>
Date: Fri Jul 18 09:15:58 2014 +0200
Rewrite autopkgtest script
Given the way the Python test suite is built, it is hard to
run it against the installed module.
So let's rewrite the whole thing with a small integration test
script based on the examples.
---
debian/rules | 5 ++++-
debian/tests/control | 3 +--
debian/tests/import | 40 ++++++++++++++++++++++++++++++++++++++++
debian/tests/upstream-tests | 7 -------
4 files changed, 45 insertions(+), 10 deletions(-)
diff --git a/debian/rules b/debian/rules
index 7b2be2f..16d38af 100755
--- a/debian/rules
+++ b/debian/rules
@@ -9,5 +9,8 @@ override_dh_installdocs:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
override_dh_auto_test:
- PYTHONPATH=. debian/tests/upstream-tests
+ set -e && \
+ for test in $$(find pyptlib/test -type f -name 'test_*.py'); do \
+ PYTHONPATH=. python $$test; \
+ done
endif
diff --git a/debian/tests/control b/debian/tests/control
index f69d15c..b1b0286 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,2 +1 @@
-Tests: upstream-tests
-Restrictions: allow-stderr
+Tests: import
diff --git a/debian/tests/import b/debian/tests/import
new file mode 100755
index 0000000..7645d7e
--- /dev/null
+++ b/debian/tests/import
@@ -0,0 +1,40 @@
+#!/usr/bin/python2
+
+import os
+import os.path
+import sys
+
+os.environ['TOR_PT_STATE_LOCATION'] = os.environ['ADTTMP']
+os.environ['TOR_PT_MANAGED_TRANSPORT_VER'] = '1'
+os.environ['TOR_PT_CLIENT_TRANSPORTS'] = 'blackfish,bluefish'
+os.environ['TOR_PT_EXTENDED_SERVER_PORT'] = '127.0.0.1:9052'
+os.environ['TOR_PT_AUTH_COOKIE_FILE'] = os.path.join(os.environ['ADTTMP'], 'auth_cookie')
+os.environ['TOR_PT_ORPORT'] = '127.0.0.1:9050'
+os.environ['TOR_PT_SERVER_BINDADDR'] = 'blackfish-127.0.0.1:5556,bluefish-127.0.0.1:5557'
+os.environ['TOR_PT_SERVER_TRANSPORTS'] = 'blackfish,bluefish'
+
+from pyptlib.client import ClientTransportPlugin
+from pyptlib.server import ServerTransportPlugin
+from pyptlib.config import EnvError
+
+client = ClientTransportPlugin()
+try:
+ client.init(["blackfish", "bluefish"])
+except EnvError, err:
+ print "pyptlib could not bootstrap ('%s')." % str(err)
+ sys.exit(1)
+
+for transport in client.getTransports():
+ client.reportMethodSuccess(transport, 5, '127.0.0.1:42', None, None)
+
+server = ServerTransportPlugin()
+try:
+ server.init(["blackfish", "bluefish"])
+except EnvError, err:
+ print "pyptlib could not bootstrap ('%s')." % str(err)
+ sys.exit(1)
+
+for transport, transport_bindaddr in server.getBindAddresses().items():
+ server.reportMethodSuccess(transport, '127.0.0.1:42', None)
+
+server.reportMethodsEnd()
diff --git a/debian/tests/upstream-tests b/debian/tests/upstream-tests
deleted file mode 100755
index 737b568..0000000
--- a/debian/tests/upstream-tests
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-set -e
-
-for test in $(find pyptlib/test -type f -name 'test_*.py'); do
- python $test
-done
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/pyptlib.git
More information about the Pkg-privacy-commits
mailing list