for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
from unittest import mock
from concurrent.futures import CancelledError
from loafer.runners import LoaferRunner
def test_runner_start():
runner = LoaferRunner(loop=mock.Mock())
runner.start()
assert runner.loop.run_forever.called
def test_runner_start_run_until_complete():
test_runner_start_run_until_complete
[a-z_][a-z0-9_]{2,30}$
This check looks for invalid names for a range of different identifiers.
You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.
If your project includes a Pylint configuration file, the settings contained in that file take precedence.
To find out more about Pylint, please refer to their site.
runner.stop = mock.Mock()
runner.start(run_forever=False)
assert runner.loop.run_until_complete.called
assert runner.stop.called
def test_runner_stop():
runner.stop()
assert runner.loop.stop.called
def test_runner_stop_with_callback():
callback = mock.Mock()
runner = LoaferRunner(loop=mock.Mock(), on_stop_callback=callback)
assert callback.called
def test_runner_with_cancelled_error():
test_runner_with_cancelled_error
runner.loop.run_forever.side_effect = CancelledError
assert runner.loop.close.called
This check looks for invalid names for a range of different identifiers.
You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.
If your project includes a Pylint configuration file, the settings contained in that file take precedence.
To find out more about Pylint, please refer to their site.