diff --git a/.coveralls.sh b/.coveralls.sh deleted file mode 100755 index 244ef4600..000000000 --- a/.coveralls.sh +++ /dev/null @@ -1,5 +0,0 @@ -if [ "$TOX_ENV" = "py27" ] -then - pip install coveralls - coveralls -fi diff --git a/.travis.yml b/.travis.yml index 489f2f03d..32eb4aa89 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,22 +1,14 @@ +dist: xenial +sudo: required + language: python -sudo: false + addons: apt: packages: - libev-dev - libevent-dev -before_install: - # Try https://github.com/travis-ci/travis-ci/issues/8363#issuecomment-327857631 - # to workaround Travis having broken Python3.5, and flaky 3.4 - # - # - - pyenv global ${TRAVIS_PYTHON_VERSION} - - > - if [[ $TRAVIS_PYTHON_VERSION = "3.5" ]]; then deactivate; sudo rm -rf /opt/python /home/travis/virtualenv; sudo add-apt-repository -y ppa:deadsnakes/ppa; - sudo apt-get update; sudo apt-get install -y python3.5 python3.5-dev; pyenv rehash; pyenv global system; pip install -U virtualenv pip; - virtualenv --python=/usr/bin/python3.5 --no-site-packages ~/working_venv; source ~/working_venv/bin/activate; - python --version; which python; pip --version; fi before_script: # Add an IPv6 config - see the corresponding Travis issue # https://github.com/travis-ci/travis-ci/issues/8361 @@ -29,9 +21,6 @@ jobs: include: - python: 3.7 env: TOX_ENV=py37 - # cf https://github.com/travis-ci/travis-ci/issues/9069#issuecomment-425720905 - sudo: required - dist: xenial - python: 3.6 env: TOX_ENV=docs - python: 3.6 @@ -44,18 +33,15 @@ jobs: env: TOX_ENV=py34 - python: 2.7 env: TOX_ENV=py27 - - python: 2.7 - env: TOX_ENV=py27-no-gevent - - python: 2.6 - env: TOX_ENV=py26 - - python: 2.6 - env: TOX_ENV=py26-no-gevent script: - tox -v -e $TOX_ENV install: - - pip install tox + - pip install tox coveralls + +after_success: + - coveralls notifications: email: tarek@mozilla.com diff --git a/circus/circusctl.py b/circus/circusctl.py index 83c80c84a..93acf580b 100644 --- a/circus/circusctl.py +++ b/circus/circusctl.py @@ -54,7 +54,7 @@ def prettify(jsonobj, prettify=True): try: lexer = get_lexer_for_mimetype("application/json") return pygments.highlight(json_str, lexer, TerminalFormatter()) - except: + except: # noqa: E722 pass return json_str diff --git a/circus/commands/restart.py b/circus/commands/restart.py index 57d66c79b..c8e3d5e73 100644 --- a/circus/commands/restart.py +++ b/circus/commands/restart.py @@ -48,6 +48,7 @@ def watcher_iter_func(reverse=True): else: return arbiter_function() + match_options = ('match', 'match', 'glob', "Watcher name matching method (simple, glob or regex)") diff --git a/circus/controller.py b/circus/controller.py index 437ab901c..0a8c0edb0 100644 --- a/circus/controller.py +++ b/circus/controller.py @@ -229,7 +229,7 @@ def dispatch(self, job, future=None): except OSError as e: return self.send_error(mid, cid, msg, str(e), cast=cast, errno=errors.OS_ERROR) - except: + except: # noqa: E722 exctype, value = sys.exc_info()[:2] tb = traceback.format_exc() reason = "command %r: %s" % (msg, value) diff --git a/circus/pidfile.py b/circus/pidfile.py index 736940a2d..71ab8d820 100644 --- a/circus/pidfile.py +++ b/circus/pidfile.py @@ -62,7 +62,7 @@ def unlink(self): if pid1 == self.pid: os.unlink(self.fname) - except: + except: # noqa: E722 pass def validate(self): diff --git a/circus/stream/__init__.py b/circus/stream/__init__.py index e3958226d..21693189e 100644 --- a/circus/stream/__init__.py +++ b/circus/stream/__init__.py @@ -9,9 +9,9 @@ from circus.util import resolve_name from circus.stream.file_stream import FileStream -from circus.stream.file_stream import WatchedFileStream # flake8: noqa -from circus.stream.file_stream import TimedRotatingFileStream # flake8: noqa -from circus.stream.redirector import Redirector +from circus.stream.file_stream import WatchedFileStream # noqa: F401 +from circus.stream.file_stream import TimedRotatingFileStream # noqa: F401 +from circus.stream.redirector import Redirector # noqa: F401 from circus.py3compat import s @@ -125,7 +125,7 @@ def get_stream(conf, reload=False): # we can have 'stream' or 'class' or 'filename' if 'class' in conf: class_name = conf.pop('class') - if not "." in class_name: + if "." not in class_name: cls = globals()[class_name] inst = cls(**conf) else: diff --git a/circus/tests/generic.py b/circus/tests/generic.py index d2ea4efb7..89525a30b 100644 --- a/circus/tests/generic.py +++ b/circus/tests/generic.py @@ -45,5 +45,5 @@ def resolve_name(name): sys.exit(callback(test_file)) else: sys.exit(callback()) - except: + except: # noqa: E722 sys.exit(1) diff --git a/circus/tests/support.py b/circus/tests/support.py index 794a9c75e..63a63d58e 100644 --- a/circus/tests/support.py +++ b/circus/tests/support.py @@ -10,13 +10,7 @@ import functools import multiprocessing import socket -try: - import sysconfig - DEBUG = sysconfig.get_config_var('Py_DEBUG') == 1 -except ImportError: - # py2.6, we don't really care about that flage here - # since no one will run Python --with-pydebug in 2.6 - DEBUG = 0 +import sysconfig try: from unittest import skip, skipIf, TestCase, TestSuite, findTestCases @@ -36,6 +30,8 @@ from circus.util import IS_WINDOWS from circus.watcher import Watcher +DEBUG = sysconfig.get_config_var('Py_DEBUG') == 1 + ioloop.install() if 'ASYNC_TEST_TIMEOUT' not in os.environ: os.environ['ASYNC_TEST_TIMEOUT'] = '30' diff --git a/circus/tests/test_arbiter.py b/circus/tests/test_arbiter.py index 3e890648b..3237b80da 100644 --- a/circus/tests/test_arbiter.py +++ b/circus/tests/test_arbiter.py @@ -709,4 +709,5 @@ def test_circushttpd(self): finally: yield arbiter.stop() + test_suite = EasyTestSuite(__name__) diff --git a/circus/tests/test_circusctl.py b/circus/tests/test_circusctl.py index 66691af6d..9106ba39a 100644 --- a/circus/tests/test_circusctl.py +++ b/circus/tests/test_circusctl.py @@ -196,4 +196,5 @@ def test_cli_help(self): self.assertEqual(prompt[3], "Documented commands (type help ):") yield self.stop_arbiter() + test_suite = EasyTestSuite(__name__) diff --git a/circus/tests/test_circusd.py b/circus/tests/test_circusd.py index 9f7cee7bb..02fbff095 100644 --- a/circus/tests/test_circusd.py +++ b/circus/tests/test_circusd.py @@ -119,4 +119,5 @@ def _check_pid(cls): main() self.assertFalse(os.path.exists(pid_file)) + test_suite = EasyTestSuite(__name__) diff --git a/circus/tests/test_command_list.py b/circus/tests/test_command_list.py index c7c23b087..3f6017674 100644 --- a/circus/tests/test_command_list.py +++ b/circus/tests/test_command_list.py @@ -19,4 +19,5 @@ def test_list_error(self): cmd = List() self.assertTrue("error" in cmd.console_msg({'foo': 'bar'})) + test_suite = EasyTestSuite(__name__) diff --git a/circus/tests/test_command_quit.py b/circus/tests/test_command_quit.py index dee68eba9..bd3598bf0 100644 --- a/circus/tests/test_command_quit.py +++ b/circus/tests/test_command_quit.py @@ -12,4 +12,5 @@ def test_quit(self): cmd.execute(arbiter, props) self.assertEqual(len(arbiter.watchers), 0) + test_suite = EasyTestSuite(__name__) diff --git a/circus/tests/test_command_set.py b/circus/tests/test_command_set.py index 1967d02a1..14e6470bf 100644 --- a/circus/tests/test_command_set.py +++ b/circus/tests/test_command_set.py @@ -64,4 +64,5 @@ def test_set_args(self): watcher = arbiter.watchers[0] self.assertEqual(watcher.options['args'], '--arg1 1 --arg2 2') + test_suite = EasyTestSuite(__name__) diff --git a/circus/tests/test_command_signal.py b/circus/tests/test_command_signal.py index 79b3db829..c5809e125 100644 --- a/circus/tests/test_command_signal.py +++ b/circus/tests/test_command_signal.py @@ -250,6 +250,7 @@ def assert_read(channel, *values): yield self.stop_arbiter() + test_suite = EasyTestSuite(__name__) if __name__ == '__main__': diff --git a/circus/tests/test_command_stats.py b/circus/tests/test_command_stats.py index e78bd381c..d39ae2d87 100644 --- a/circus/tests/test_command_stats.py +++ b/circus/tests/test_command_stats.py @@ -73,4 +73,5 @@ def test_execute(self): props = {'name': 'meh', 'process': 'meh'} self.assertRaises(MessageError, cmd.execute, arbiter, props) + test_suite = EasyTestSuite(__name__) diff --git a/circus/tests/test_config.py b/circus/tests/test_config.py index 84ecc76ac..31f6e928d 100644 --- a/circus/tests/test_config.py +++ b/circus/tests/test_config.py @@ -192,7 +192,7 @@ def test_empty_include(self, mock_logger_warn): """https://github.com/circus-tent/circus/pull/473""" try: get_config(_CONF['empty_include']) - except: + except: # noqa: E722 self.fail('Non-existent includes should not raise') self.assertTrue(mock_logger_warn.called) diff --git a/circus/tests/test_convert_option.py b/circus/tests/test_convert_option.py index 5ad1d8615..9eddfeacb 100644 --- a/circus/tests/test_convert_option.py +++ b/circus/tests/test_convert_option.py @@ -46,4 +46,5 @@ def test_hooks(self): self.assertRaises(ArgumentError, convert_option, 'hooks', 'before_start:one:two') + test_suite = EasyTestSuite(__name__) diff --git a/circus/tests/test_logging.py b/circus/tests/test_logging.py index beb3b5f81..d73ca512a 100644 --- a/circus/tests/test_logging.py +++ b/circus/tests/test_logging.py @@ -109,6 +109,7 @@ def run_circusd(options=(), config=(), log_capture_path="log.txt", # use (lock). pass + EXAMPLE_YAML = """\ version: 1 disable_existing_loggers: false @@ -262,4 +263,5 @@ def test_loggerconfig_ini_opt(self): additional_files={"logging.ini": logging_dictconfig_to_ini(config)} ) + test_suite = EasyTestSuite(__name__) diff --git a/circus/tests/test_papa_stream.py b/circus/tests/test_papa_stream.py index 0d1b4153f..60ff0dfec 100644 --- a/circus/tests/test_papa_stream.py +++ b/circus/tests/test_papa_stream.py @@ -23,7 +23,7 @@ def run_process(testfile, *args, **kw): with open(testfile, 'a+') as f: f.write('START') time.sleep(1.) - except: + except: # noqa: E722 return 1 diff --git a/circus/tests/test_pidfile.py b/circus/tests/test_pidfile.py index 920b0725b..4c80ac40a 100644 --- a/circus/tests/test_pidfile.py +++ b/circus/tests/test_pidfile.py @@ -80,4 +80,5 @@ def test_pidfile_data(self): except Exception as e: self.fail(str(e)) + test_suite = EasyTestSuite(__name__) diff --git a/circus/tests/test_plugin_command_reloader.py b/circus/tests/test_plugin_command_reloader.py index 5467816f5..dcbe1c678 100644 --- a/circus/tests/test_plugin_command_reloader.py +++ b/circus/tests/test_plugin_command_reloader.py @@ -89,4 +89,5 @@ def test_handle_recv_implemented(self): plugin = self.make_plugin(CommandReloader, active=True) plugin.handle_recv('whatever') + test_suite = EasyTestSuite(__name__) diff --git a/circus/tests/test_plugin_flapping.py b/circus/tests/test_plugin_flapping.py index ef1ae5a17..97925e84d 100644 --- a/circus/tests/test_plugin_flapping.py +++ b/circus/tests/test_plugin_flapping.py @@ -72,4 +72,5 @@ def test_minus_one_max_retry_triggers_restart(self, timer_mock, cast_mock): cast_mock.assert_called_with("stop", name="test") self.assertTrue(timer_mock.called) + test_suite = EasyTestSuite(__name__) diff --git a/circus/tests/test_plugin_resource_watcher.py b/circus/tests/test_plugin_resource_watcher.py index 098eec039..f619052fe 100644 --- a/circus/tests/test_plugin_resource_watcher.py +++ b/circus/tests/test_plugin_resource_watcher.py @@ -157,4 +157,5 @@ def test_resource_watcher_min_cpu(self): '_resource_watcher.test.under_cpu') yield self.stop_arbiter() + test_suite = EasyTestSuite(__name__) diff --git a/circus/tests/test_plugin_watchdog.py b/circus/tests/test_plugin_watchdog.py index 771e33c6d..3cfaa9ee7 100644 --- a/circus/tests/test_plugin_watchdog.py +++ b/circus/tests/test_plugin_watchdog.py @@ -70,4 +70,5 @@ def test_watchdog_discovery_not_found(self): self.assertEqual(len(pid_status), 0, pid_status) yield self.stop_arbiter() + test_suite = EasyTestSuite(__name__) diff --git a/circus/tests/test_reloadconfig.py b/circus/tests/test_reloadconfig.py index fe0c5bbef..4a57feaca 100644 --- a/circus/tests/test_reloadconfig.py +++ b/circus/tests/test_reloadconfig.py @@ -169,4 +169,5 @@ def test_reload_ignorearbiterwatchers(self): yield a.reload_from_config(_CONF['reload_statsd']) self.assertEqual(statsd, a.get_watcher('circusd-stats')) + test_suite = EasyTestSuite(__name__) diff --git a/circus/tests/test_runner.py b/circus/tests/test_runner.py index b01cca0c6..3e9a5fe1b 100644 --- a/circus/tests/test_runner.py +++ b/circus/tests/test_runner.py @@ -17,4 +17,5 @@ def test_dummy(self): self.assertTrue(res) yield self.stop_arbiter() + test_suite = EasyTestSuite(__name__) diff --git a/circus/tests/test_sighandler.py b/circus/tests/test_sighandler.py index c73ae3f88..ac00959f3 100644 --- a/circus/tests/test_sighandler.py +++ b/circus/tests/test_sighandler.py @@ -20,4 +20,5 @@ def test_handler(self): res = yield async_poll_for(self.test_file, 'QUIT') self.assertTrue(res) + test_suite = EasyTestSuite(__name__) diff --git a/circus/tests/test_stats_client.py b/circus/tests/test_stats_client.py index 8aff2920f..d3f4335c3 100644 --- a/circus/tests/test_stats_client.py +++ b/circus/tests/test_stats_client.py @@ -22,7 +22,7 @@ def run_process(*args, **kw): os.getpid(), i)) sys.stderr.flush() time.sleep(.25) - except: + except: # noqa: E722 return 1 @@ -89,4 +89,5 @@ def test_handler(self): watcher) yield self.stop_arbiter() + test_suite = EasyTestSuite(__name__) diff --git a/circus/tests/test_stats_collector.py b/circus/tests/test_stats_collector.py index 796c58a22..8c7804237 100644 --- a/circus/tests/test_stats_collector.py +++ b/circus/tests/test_stats_collector.py @@ -194,4 +194,5 @@ def test_socketstats(self): self.assertTrue(stat['fd'] in self.fds) self.assertTrue(stat['reads'] > 1) + test_suite = EasyTestSuite(__name__) diff --git a/circus/tests/test_stats_publisher.py b/circus/tests/test_stats_publisher.py index 42ba43d3b..2dd79b349 100644 --- a/circus/tests/test_stats_publisher.py +++ b/circus/tests/test_stats_publisher.py @@ -36,4 +36,5 @@ def test_publish_silent_zmq_errors_when_socket_closed(self): stat = {'subtopic': 1, 'foo': 'bar'} publisher.publish('foobar', stat) + test_suite = EasyTestSuite(__name__) diff --git a/circus/tests/test_stats_streamer.py b/circus/tests/test_stats_streamer.py index 8fa1d655f..947cf5f39 100644 --- a/circus/tests/test_stats_streamer.py +++ b/circus/tests/test_stats_streamer.py @@ -99,4 +99,5 @@ def test_remove_pid(self): streamer.remove_pid('foobar', 1235) self.assertTrue(streamer._callbacks['foobar'].stop.called) + test_suite = EasyTestSuite(__name__) diff --git a/circus/tests/test_stream.py b/circus/tests/test_stream.py index 543dac5ad..69314a2cd 100644 --- a/circus/tests/test_stream.py +++ b/circus/tests/test_stream.py @@ -25,7 +25,7 @@ def run_process(testfile, *args, **kw): with open(testfile, 'a+') as f: f.write('START') time.sleep(1.) - except: + except: # noqa: E722 return 1 diff --git a/circus/tests/test_umask.py b/circus/tests/test_umask.py index 22ea09dd7..160d5a932 100644 --- a/circus/tests/test_umask.py +++ b/circus/tests/test_umask.py @@ -130,6 +130,7 @@ def test_set_by_arbiter(self): mode = oct(os.stat(self.test_file).st_mode)[-3:] self.assertEqual(mode, '777') + test_suite = EasyTestSuite(__name__) if __name__ == '__main__': diff --git a/circus/tests/test_util.py b/circus/tests/test_util.py index 20ceebdd0..1b4256d0d 100644 --- a/circus/tests/test_util.py +++ b/circus/tests/test_util.py @@ -309,4 +309,5 @@ def _stat(path): finally: util.os.stat = _old_os_stat + test_suite = EasyTestSuite(__name__) diff --git a/circus/tests/test_watcher.py b/circus/tests/test_watcher.py index 73e875eac..828fce28d 100644 --- a/circus/tests/test_watcher.py +++ b/circus/tests/test_watcher.py @@ -671,4 +671,5 @@ def test_stopping_a_watcher_doesnt_spawn(self): # And be sure we don't spawn new processes in the meantime. self.assertFalse(watcher.spawn_processes.called) + test_suite = EasyTestSuite(__name__) diff --git a/circus/tests/venv/lib/python2.6/no-global-site-packages.txt b/circus/tests/venv/lib/python2.6/no-global-site-packages.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/circus/tests/venv/lib/python2.6/orig-prefix.txt b/circus/tests/venv/lib/python2.6/orig-prefix.txt deleted file mode 100644 index 535eb0f0e..000000000 --- a/circus/tests/venv/lib/python2.6/orig-prefix.txt +++ /dev/null @@ -1 +0,0 @@ -/System/Library/Frameworks/Python.framework/Versions/2.6 \ No newline at end of file diff --git a/circus/tests/venv/lib/python2.6/site-packages/easy-install.pth b/circus/tests/venv/lib/python2.6/site-packages/easy-install.pth deleted file mode 100644 index c660dc7da..000000000 --- a/circus/tests/venv/lib/python2.6/site-packages/easy-install.pth +++ /dev/null @@ -1,3 +0,0 @@ -import sys; sys.__plen = len(sys.path) -./pip-7.7-py2.6.egg -import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new) diff --git a/circus/util.py b/circus/util.py index 374d8e8b8..76bf43a71 100644 --- a/circus/util.py +++ b/circus/util.py @@ -293,6 +293,7 @@ def get_info(process=None, interval=0, with_childs=False): return info + TRUTHY_STRINGS = ('yes', 'true', 'on', '1') FALSY_STRINGS = ('no', 'false', 'off', '0') @@ -618,7 +619,7 @@ def resolve_name(import_name, silent=False, reload=False): raise_with_tb(ImportStringError(import_name, e)) -_SECTION_NAME = '\w\.\-' +_SECTION_NAME = r'\w\.\-' _PATTERN1 = r'\$\(%%s\.([%s]+)\)' % _SECTION_NAME _PATTERN2 = r'\(\(%%s\.([%s]+)\)\)' % _SECTION_NAME _CIRCUS_VAR = re.compile(_PATTERN1 % 'circus' + '|' + @@ -790,10 +791,7 @@ def _read(self, fp, fpname): raise MissingSectionHeaderError(fpname, lineno, line) # an option line? else: - try: - mo = self._optcre.match(line) # 2.7 - except AttributeError: - mo = self.OPTCRE.match(line) # 2.6 + mo = self._optcre.match(line) # 2.7 if mo: optname, vi, optval = mo.group('option', 'vi', 'value') self.optionxform = text_type diff --git a/docs/source/for-ops/index.rst b/docs/source/for-ops/index.rst index 3ccd299ef..c5fc88b17 100644 --- a/docs/source/for-ops/index.rst +++ b/docs/source/for-ops/index.rst @@ -13,7 +13,7 @@ The first step to manage a Circus daemon is to write its configuration file. See :ref:`configuration`. If you are deploying a web stack, have a look at :ref:`sockets`. -Circus can be deployed using Python 2.6, 2.7, 3.2 or 3.3 - most deployments +Circus can be deployed using Python 2.7, 3.2 or 3.3 - most deployments out there are done in 2.7. To learn how to deploy Circus, check out :ref:`deployment`. diff --git a/docs/source/installation.rst b/docs/source/installation.rst index def181c18..ba5287358 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -36,7 +36,7 @@ More on Requirements Circus works with: -- Python 2.6, 2.7, 3.2 or 3.3 +- Python 2.7, 3.2 or 3.3 - zeromq >= 2.1.10 - The version of zeromq supported is ultimately determined by what version of `pyzmq `_ is installed by pip during circus installation. - Their current release supports 2.x (limited), 3.x, and 4.x ZeroMQ versions. diff --git a/docs/source/tutorial/step-by-step.rst b/docs/source/tutorial/step-by-step.rst index 7b9c55f9c..d47905318 100644 --- a/docs/source/tutorial/step-by-step.rst +++ b/docs/source/tutorial/step-by-step.rst @@ -13,7 +13,7 @@ We're going to supervise a WSGI application. Installation ------------ -Circus is tested on Mac OS X and Linux with the latest Python 2.6, 2.7, +Circus is tested on Mac OS X and Linux with the latest Python 2.7, 3.2 and 3.3. To run a full Circus, you will also need **libzmq**, **libevent** & **virtualenv**. diff --git a/setup.py b/setup.py index a22060cab..fdd7a5486 100644 --- a/setup.py +++ b/setup.py @@ -2,8 +2,8 @@ from setuptools import setup, find_packages from circus import __version__ -if not hasattr(sys, 'version_info') or sys.version_info < (2, 6, 0, 'final'): - raise SystemExit("Circus requires Python 2.6 or higher.") +if not hasattr(sys, 'version_info') or sys.version_info < (2, 7, 0, 'final'): + raise SystemExit("Circus requires Python 2.7 or higher.") install_requires = ['psutil', 'pyzmq>=13.1.0,<17.0', 'tornado>=3.0,<5.0', 'six'] @@ -30,7 +30,6 @@ classifiers=[ "Programming Language :: Python", "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", diff --git a/tox.ini b/tox.ini index 038b55382..01cfd9046 100644 --- a/tox.ini +++ b/tox.ini @@ -1,16 +1,5 @@ [tox] -envlist = py26,py26-no-gevent,py27,py27-no-gevent,py34,py35,py36,py37,flake8,docs - -[testenv:py26] -deps = - {[testenv]deps} - gevent<1.2 - unittest2 - -[testenv:py26-no-gevent] -deps = - {[testenv]deps} - unittest2 +envlist = py27,py34,py35,py36,py37,flake8,docs [testenv:py27] passenv = PWD TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH @@ -19,13 +8,11 @@ deps = {[testenv]deps} nose-cov coverage - coveralls gevent circus-web commands = nosetests -vs --with-coverage --cover-package=circus circus/tests - coveralls [testenv] passenv = PWD