From 9771fb86185951f891a1bb23c5b3bbc3e742b808 Mon Sep 17 00:00:00 2001 From: John Chilton <jmchilton@gmail.com> Date: Fri, 6 Mar 2015 20:16:37 -0500 Subject: [PATCH] More PEP8-y test helper names. --- test/amqp_test.py | 4 ++-- test/integration_test.py | 24 ++++++++++++------------ test/manager_drmaa_test.py | 6 +++--- test/test_utils.py | 10 +++++----- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/test/amqp_test.py b/test/amqp_test.py index 03082d3f..04e60359 100644 --- a/test/amqp_test.py +++ b/test/amqp_test.py @@ -1,12 +1,12 @@ import threading -from .test_utils import skipUnlessModule +from .test_utils import skip_unless_module from pulsar.client import amqp_exchange TEST_CONNECTION = "memory://test_amqp" -@skipUnlessModule("kombu") +@skip_unless_module("kombu") def test_amqp(): manager1_exchange = amqp_exchange.PulsarExchange(TEST_CONNECTION, "manager_test") manager3_exchange = amqp_exchange.PulsarExchange(TEST_CONNECTION, "manager3_test") diff --git a/test/integration_test.py b/test/integration_test.py index 2fdc7ae8..170c82b5 100644 --- a/test/integration_test.py +++ b/test/integration_test.py @@ -4,9 +4,9 @@ from six import next, itervalues from six.moves import configparser from .test_utils import ( TempDirectoryTestCase, - skipUnlessExecutable, - skipUnlessModule, - skipUnlessAnyModule + skip_unless_executable, + skip_unless_module, + skip_unless_any_module ) from .test_utils import test_pulsar_app @@ -96,7 +96,7 @@ class IntegrationTests(BaseIntegrationTest): def test_integration_no_requirement(self): self._run(private_token=None, **self.default_kwargs) - @skipUnlessModule("drmaa") + @skip_unless_module("drmaa") def test_integration_as_user(self): job_props = {'type': 'queued_external_drmaa', "production": "false"} self._run(job_conf_props=job_props, private_token=None, default_file_action="copy", user='u1', **self.default_kwargs) @@ -104,8 +104,8 @@ class IntegrationTests(BaseIntegrationTest): def test_integration_local_setup(self): self._run(private_token=None, default_file_action="remote_copy", local_setup=True, **self.default_kwargs) - @skipUnlessModule("pycurl") - @skipUnlessModule("kombu") + @skip_unless_module("pycurl") + @skip_unless_module("kombu") def test_message_queue(self): self._run( app_conf=dict(message_queue_url="memory://test1"), @@ -128,7 +128,7 @@ class IntegrationTests(BaseIntegrationTest): def test_integration_default(self): self._run(private_token=None, **self.default_kwargs) - @skipUnlessModule("pycurl") + @skip_unless_module("pycurl") def test_integration_curl(self): self._run(private_token=None, transport="curl", **self.default_kwargs) @@ -138,19 +138,19 @@ class IntegrationTests(BaseIntegrationTest): def test_integration_errors(self): self._run(app_conf={"private_token": "testtoken"}, private_token="testtoken", test_errors=True, **self.default_kwargs) - @skipUnlessModule("drmaa") + @skip_unless_module("drmaa") def test_integration_drmaa(self): self._run(app_conf={}, job_conf_props={'type': 'queued_drmaa'}, private_token=None, **self.default_kwargs) - @skipUnlessExecutable("condor_submit") + @skip_unless_executable("condor_submit") def test_integration_condor(self): self._run(app_conf={}, job_conf_props={'type': 'queued_condor'}, private_token=None, **self.default_kwargs) - @skipUnlessExecutable("qsub") + @skip_unless_executable("qsub") def test_integration_cli_torque(self): self._run(app_conf={}, job_conf_props={'type': 'queued_cli', 'job_plugin': 'Torque'}, private_token=None, **self.default_kwargs) - @skipUnlessExecutable("sbatch") + @skip_unless_executable("sbatch") def test_integration_cli_slurm(self): self._run(app_conf={}, job_conf_props={'type': 'queued_cli', 'job_plugin': 'Slurm'}, private_token=None, **self.default_kwargs) @@ -158,7 +158,7 @@ class IntegrationTests(BaseIntegrationTest): class DirectIntegrationTests(IntegrationTests): default_kwargs = dict(direct_interface=True, test_requirement=False) - @skipUnlessAnyModule(["pycurl", "poster", "requests_toolbelt"]) + @skip_unless_any_module(["pycurl", "poster", "requests_toolbelt"]) def test_integration_remote_transfer(self): self._run( private_token=None, diff --git a/test/manager_drmaa_test.py b/test/manager_drmaa_test.py index 91ef1081..52cf7e99 100644 --- a/test/manager_drmaa_test.py +++ b/test/manager_drmaa_test.py @@ -1,6 +1,6 @@ from .test_utils import ( BaseManagerTestCase, - skipUnlessModule + skip_unless_module ) from pulsar.managers.queued_drmaa import DrmaaQueueManager @@ -19,10 +19,10 @@ class DrmaaManagerTest(BaseManagerTestCase): def _set_manager(self, **kwds): self.manager = DrmaaQueueManager('_default_', self.app, **kwds) - @skipUnlessModule("drmaa") + @skip_unless_module("drmaa") def test_simple_execution(self): self._test_simple_execution(self.manager) - @skipUnlessModule("drmaa") + @skip_unless_module("drmaa") def test_cancel(self): self._test_cancelling(self.manager) diff --git a/test/test_utils.py b/test/test_utils.py index 7a84c80f..63cf493a 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -250,13 +250,13 @@ def test_pulsar_app(global_conf={}, app_conf={}, test_conf={}): pass -def skipUnlessExecutable(executable): - if __which(executable): +def skip_unless_executable(executable): + if _which(executable): return lambda func: func return skip("PATH doesn't contain executable %s" % executable) -def skipUnlessModule(module): +def skip_unless_module(module): available = True try: __import__(module) @@ -267,7 +267,7 @@ def skipUnlessModule(module): return skip("Module %s could not be loaded, dependent test skipped." % module) -def skipUnlessAnyModule(modules): +def skip_unless_any_module(modules): available = False for module in modules: try: @@ -280,7 +280,7 @@ def skipUnlessAnyModule(modules): return skip("None of the modules %s could be loaded, dependent test skipped." % modules) -def __which(program): +def _which(program): def is_exe(fpath): return isfile(fpath) and access(fpath, X_OK) -- GitLab