From 1601e0fb87ae50d6f3304a8fdd58520028d0c884 Mon Sep 17 00:00:00 2001 From: Andrew Ferrier Date: Wed, 17 Dec 2014 18:46:32 +0000 Subject: [PATCH] Set up tests module. --- Makefile | 2 +- tests/__init__.py | 0 email2pdf_unittest => tests/test_email2pdf.py | 7 +++++-- 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 tests/__init__.py rename email2pdf_unittest => tests/test_email2pdf.py (99%) diff --git a/Makefile b/Makefile index 82ab1ca..9c003bb 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ builddeb: fakeroot dpkg-deb --build $(TEMPDIR) . unittest: - ./email2pdf_unittest + python3 -m unittest discover clean: rm -f *.deb diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/email2pdf_unittest b/tests/test_email2pdf.py similarity index 99% rename from email2pdf_unittest rename to tests/test_email2pdf.py index cb0417d..9529a73 100755 --- a/email2pdf_unittest +++ b/tests/test_email2pdf.py @@ -30,12 +30,16 @@ def setUpModule(): examineDir = tempfile.mkdtemp(dir=examineDir) print("Output examination directory: " + examineDir) + print("Checking if online... ", end="") + sys.stdout.flush() ONLINE_URL = "https://raw.githubusercontent.com/andrewferrier/email2pdf/master" try: - requests.get(ONLINE_URL) + requests.get(ONLINE_URL, timeout=1) isOnline = True + print("Yes.") except: isOnline = False + print("No.") def touch(fname): @@ -112,7 +116,6 @@ def invokeEmail2PDF(self, inputFile=False, outputDirectory=None, sysErrExpected= if outputFile: options.extend(['-o', outputFile]) - options.extend(sys.argv[1:]) options.extend(extraParams) self.timeInvoked = datetime.now()