From 27e866ebf347454e378f4c24ce31b9dba3a5e64d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 2 Nov 2018 20:07:30 +0100 Subject: [PATCH] Skip scenario that requires environment that is not set --- tests/test_shipping_ups.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/test_shipping_ups.py b/tests/test_shipping_ups.py index b3ab4badc8..71da8a73d3 100644 --- a/tests/test_shipping_ups.py +++ b/tests/test_shipping_ups.py @@ -1,8 +1,9 @@ # This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. -import unittest import doctest +import os +import unittest from trytond.tests.test_tryton import ModuleTestCase from trytond.tests.test_tryton import suite as test_suite @@ -18,8 +19,12 @@ def suite(): suite = test_suite() suite.addTests(unittest.TestLoader().loadTestsFromTestCase( ShippingUpsTestCase)) - suite.addTests(doctest.DocFileSuite('scenario_shipping_ups.rst', - tearDown=doctest_teardown, encoding='utf-8', - optionflags=doctest.REPORT_ONLY_FIRST_FAILURE, - checker=doctest_checker)) + if (os.getenv('UPS_USER_ID') + and os.getenv('UPS_PASSWORD') + and os.getenv('UPS_LICENSE') + and os.getenv('UPS_ACCOUNT_NUMBER')): + suite.addTests(doctest.DocFileSuite('scenario_shipping_ups.rst', + tearDown=doctest_teardown, encoding='utf-8', + optionflags=doctest.REPORT_ONLY_FIRST_FAILURE, + checker=doctest_checker)) return suite