diff --git a/.travis.yml b/.travis.yml index 4c8f91c4e402c618db49c3e947d970b369cda970..41e860460aada34cebe5912b5054664f0470dbba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,25 @@ # TODO: test condor language: python -python: 2.7 -sudo: required -env: - - TOX_ENV=py27-lint - - TOX_ENV=py34-lint - - TOX_ENV=py27-lint-readme - - TOX_ENV=lint-docs - - TOX_ENV=py27 SETUP=true - - TOX_ENV=py34 SETUP=true - - TOX_ENV=py34-unit SETUP=true - - TOX_ENV=py27-install-wheel +matrix: + include: + - python: 2.7 + env: TOX_ENV=py27-lint + - python: 2.7 + env: TOX_ENV=py27-lint-readme + - python: 2.7 + env: TOX_ENV=lint-docs + - python: 2.7 + env: TOX_ENV=py27 SETUP=true + - python: 2.7 + env: TOX_ENV=py27-install-wheel + - python: 3.5 + env: TOX_ENV=py35-lint + - python: 3.5 + env: TOX_ENV=py35 SETUP=true + - python: 3.5 + env: TOX_ENV=py35-unit SETUP=true + allow_failures: + - env: TOX_ENV=py35 SETUP=true install: - pip install tox @@ -18,9 +27,5 @@ install: script: export PULSAR_TEST_KEY=test_data/testkey; export TEST_WEBAPP_POST_SHUTDOWN_SLEEP=1; . local_env.sh; tox -e $TOX_ENV -matrix: - allow_failures: - - env: TOX_ENV=py34 SETUP=true - after_success: - coveralls diff --git a/pulsar/client/action_mapper.py b/pulsar/client/action_mapper.py index 122d4abd585185e709da76a5a4f3742640483fba..96a70d97b0aa24b258527ec15ad4afacfb73cd55 100644 --- a/pulsar/client/action_mapper.py +++ b/pulsar/client/action_mapper.py @@ -625,7 +625,7 @@ class PrefixPathMapper(BasePathMapper): return path.startswith(self.prefix_path) def to_pattern(self): - pattern_str = "(%s%s[^\s,\"\']+)" % (escape(self.prefix_path), escape(sep)) + pattern_str = r"(%s%s[^\s,\"\']+)" % (escape(self.prefix_path), escape(sep)) return compile(pattern_str) def to_dict(self): diff --git a/pulsar/client/amqp_exchange_factory.py b/pulsar/client/amqp_exchange_factory.py index 72f917860c7f93d6add4c600f2bf4900fea48d91..c36242c44fb29bdcda20b583787f937db48ffab0 100644 --- a/pulsar/client/amqp_exchange_factory.py +++ b/pulsar/client/amqp_exchange_factory.py @@ -33,7 +33,7 @@ def parse_amqp_connect_ssl_params(params): def parse_amqp_publish_kwds(params): all_publish_params = filter_destination_params(params, "amqp_publish_") retry_policy_params = {} - for key in all_publish_params.keys(): + for key in all_publish_params.copy().keys(): if key.startswith("retry_"): value = all_publish_params[key] retry_policy_params[key[len("retry_"):]] = value diff --git a/pulsar/client/test/check.py b/pulsar/client/test/check.py index 04afc072fb718384d58ca3ab1f8d79c23d2ae1f5..6973bf7176e758ab86164557586fc719a1d57cb1 100644 --- a/pulsar/client/test/check.py +++ b/pulsar/client/test/check.py @@ -271,11 +271,11 @@ class Waiter(object): def __init__(self, client, client_manager): self.client = client self.client_manager = client_manager - self.async = hasattr(client_manager, 'ensure_has_status_update_callback') + self.background = hasattr(client_manager, 'ensure_has_status_update_callback') self.__setup_callback() def __setup_callback(self): - if self.async: + if self.background: self.event = threading.Event() def on_update(message): @@ -287,7 +287,7 @@ class Waiter(object): def wait(self, seconds=15): final_status = None - if not self.async: + if not self.background: i = 0 # Wait for seconds * 2 half second intervals while i < (seconds * 2): diff --git a/pulsar/client/transport/standard.py b/pulsar/client/transport/standard.py index 25ce84c490a2f4caf210300763dcd62d2f9ebf02..dc67ad25ee8c605d30823039d23204ee81368e4b 100644 --- a/pulsar/client/transport/standard.py +++ b/pulsar/client/transport/standard.py @@ -43,7 +43,7 @@ class Urllib2Transport(object): request.add_header('Content-Length', str(size)) try: response = self._url_open(request, data) - except socket.timeout as exc: + except socket.timeout: raise PulsarClientTransportError(code=PulsarClientTransportError.TIMEOUT) except URLError as exc: raise PulsarClientTransportError(transport_message=exc.reason) diff --git a/pulsar/managers/queued.py b/pulsar/managers/queued.py index face51dbe69e8a48bcbd0fa3a6142902dc794a69..3751878070c8244e75a6a1452b7613eed1df55e4 100644 --- a/pulsar/managers/queued.py +++ b/pulsar/managers/queued.py @@ -89,7 +89,7 @@ class QueueManager(Manager): except Exception: log.exception("Running command but failed to delete - command may rerun on Pulsar boot.") # _run will not do anything if job has been cancelled. - self._run(job_id, command_line, async=False) + self._run(job_id, command_line, background=False) except Exception: log.warn("Uncaught exception running job with job_id %s" % job_id) traceback.print_exc() diff --git a/pulsar/managers/unqueued.py b/pulsar/managers/unqueued.py index 321a4ba003a29f55ad8cba49c829d9a4dd44f175..5aba36198101355344db2004da497dac38f2ee50 100644 --- a/pulsar/managers/unqueued.py +++ b/pulsar/managers/unqueued.py @@ -123,7 +123,7 @@ class Manager(DirectoryBaseManager): self._job_directory(job_id).remove_metadata(JOB_FILE_SUBMITTED) return pid - def _run(self, job_id, command_line, async=True): + def _run(self, job_id, command_line, background=True): with self._get_job_lock(job_id): if self._was_cancelled(job_id): return @@ -137,7 +137,7 @@ class Manager(DirectoryBaseManager): stderr=stderr) with self._get_job_lock(job_id): self._record_pid(job_id, proc.pid) - if async: + if background: thread.start_new_thread(self._monitor_execution, (job_id, proc, stdout, stderr)) else: self._monitor_execution(job_id, proc, stdout, stderr) diff --git a/pulsar/managers/util/cli/job/slurm_torque.py b/pulsar/managers/util/cli/job/slurm_torque.py index b3de6099fbf4ef0e0a6c9f353cae763274a8b23e..9e13bf9f08e947204d0b8c163f81910ef0f357ae 100644 --- a/pulsar/managers/util/cli/job/slurm_torque.py +++ b/pulsar/managers/util/cli/job/slurm_torque.py @@ -18,7 +18,7 @@ class SlurmTorque(Torque): for line in status.strip().splitlines(): if line.startswith("Job ID"): continue - line_parts = re.compile("\s+").split(line) + line_parts = re.compile(r"\s+").split(line) if len(line_parts) < 5: continue id = line_parts[0] diff --git a/test/amqp_test.py b/test/amqp_test.py index 955629a5b445e433d11d823cef10c578ad68bd9b..a6e85b76811be8badf16b67c33932d165b868f3d 100644 --- a/test/amqp_test.py +++ b/test/amqp_test.py @@ -25,6 +25,7 @@ def test_amqp(): thread1.start() thread2.start() thread3.start() + time.sleep(0.5) manager1_exchange.publish("manager_test", u"cow1") manager2_exchange.publish("manager2_test", u"cow2") manager3_exchange.publish("manager3_test", u"cow3") @@ -37,7 +38,7 @@ def test_amqp(): class TestThread(threading.Thread): def __init__(self, queue_name, exchange): - super(TestThread, self).__init__() + super(TestThread, self).__init__(target=self.run) self.queue_name = queue_name self.daemon = True self.exchange = exchange diff --git a/test/script_run_test.py b/test/script_run_test.py index 5998e1536f9be6ff7db7a3adad451d285d62568c..14fd4fbd699b24df1edf3a40619a48ddf4e41c55 100644 --- a/test/script_run_test.py +++ b/test/script_run_test.py @@ -31,7 +31,7 @@ class ScriptRunTestCase(TempDirectoryTestCase): "--command", "echo `pwd` > output1; cp input1 output_test2", "--working_directory", self._working_directory, "--output", "output1", - "--output_pattern", "output_test\d", + "--output_pattern", r"output_test\d", "--result_json", self._result, ]) exit_code = run.main(run_args) diff --git a/tox.ini b/tox.ini index d550a99f9ace8823185ae3e327a107b00345800d..325be4b49d3b9001c9ca2b568e73c6fccda95fab 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27-lint, py27-lint-readme, lint-docs, py34-lint, py27, py34, py27-unit, py34-unit +envlist = py27-lint, py27-lint-readme, lint-docs, py35-lint, py27, py34, py27-unit, py34-unit toxworkdir={env:TOX_WORK_DIR:.tox} [testenv] @@ -13,13 +13,13 @@ passenv = DRMAA_LIBRARY_PATH [testenv:py27-unit] commands = nosetests --exclude '.*integration.*' [] -[testenv:py34] +[testenv:py35] deps = -rrequirements3.txt -rdev-requirements.txt drmaa -[testenv:py34-unit] +[testenv:py35-unit] commands = nosetests --verbose --exclude '.*integration.*' [] deps = -rrequirements3.txt @@ -28,12 +28,12 @@ deps = [testenv:py27-lint] -commands = flake8 pulsar test +commands = flake8 --ignore W504 pulsar test skip_install = True deps = flake8 -[testenv:py34-lint] -commands = flake8 pulsar test +[testenv:py35-lint] +commands = flake8 --ignore W504 pulsar test skip_install = True deps = flake8