Added a skipIf() decorator for a test which should not be run unless the ghostscript binary is available in the test environment.
- Legacy-Id: 16076
This commit is contained in:
parent
7224e06f3d
commit
b610f0b099
|
@ -7,6 +7,7 @@ import shutil
|
|||
import datetime
|
||||
import urlparse
|
||||
import random
|
||||
from unittest import skipIf
|
||||
|
||||
import debug # pyflakes:ignore
|
||||
|
||||
|
@ -41,6 +42,16 @@ from ietf.doc.factories import DocumentFactory
|
|||
from ietf.submit.tests import submission_file
|
||||
|
||||
|
||||
if os.path.exists(settings.GHOSTSCRIPT_COMMAND):
|
||||
skip_pdf_tests = False
|
||||
skip_message = ""
|
||||
else:
|
||||
import sys
|
||||
skip_pdf_tests = True
|
||||
skip_message = ("Skipping pdf test: The binary for ghostscript wasn't found in the\n "
|
||||
"location indicated in settings.py.")
|
||||
sys.stderr.write(" "+skip_message+'\n')
|
||||
|
||||
class MeetingTests(TestCase):
|
||||
def setUp(self):
|
||||
self.materials_dir = self.tempdir('materials')
|
||||
|
@ -501,6 +512,7 @@ class MeetingTests(TestCase):
|
|||
self.assertEqual(response.get('Content-Type'), 'application/octet-stream')
|
||||
os.unlink(filename)
|
||||
|
||||
@skipIf(skip_pdf_tests, skip_message)
|
||||
def test_session_draft_pdf(self):
|
||||
session = SessionFactory(group__type_id='wg',meeting__type_id='ietf')
|
||||
doc = DocumentFactory(type_id='draft')
|
||||
|
|
|
@ -723,7 +723,8 @@ def session_draft_pdf(request, num, acronym):
|
|||
pdfmarks.close()
|
||||
pdfh, pdfn = mkstemp()
|
||||
os.close(pdfh)
|
||||
code, out, err = pipe("gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=" + pdfn + " " + pdf_list + " " + pmn)
|
||||
gs = settings.GHOSTSCRIPT_COMMAND
|
||||
code, out, err = pipe(gs + " -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=" + pdfn + " " + pdf_list + " " + pmn)
|
||||
assertion('code == 0')
|
||||
|
||||
pdf = open(pdfn,"r")
|
||||
|
|
|
@ -805,6 +805,9 @@ DAYS_TO_EXPIRE_REGISTRATION_LINK = 3
|
|||
HTPASSWD_COMMAND = "/usr/bin/htpasswd"
|
||||
HTPASSWD_FILE = "/www/htpasswd"
|
||||
|
||||
# Generation of pdf files
|
||||
GHOSTSCRIPT_COMMAND = "/usr/bin/gs"
|
||||
|
||||
# Generation of bibxml files for xml2rfc
|
||||
BIBXML_BASE_PATH = '/a/www/ietf-ftp/xml2rfc'
|
||||
|
||||
|
|
Loading…
Reference in a new issue