style: switching from yapf to isort/black

This commit is contained in:
Romain Dorgueil
2018-08-11 06:34:37 +02:00
parent ebba06822b
commit d1c9beae97
93 changed files with 805 additions and 816 deletions

View File

@ -9,17 +9,11 @@ def test_entrypoint():
for command in pkg_resources.iter_entry_points('bonobo.commands'):
commands[command.name] = command
assert not {
'convert',
'init',
'inspect',
'run',
'version',
}.difference(set(commands))
assert not {'convert', 'init', 'inspect', 'run', 'version'}.difference(set(commands))
@all_runners
def test_no_command(runner):
_, err, exc = runner(catch_errors=True)
assert type(exc) == SystemExit
assert 'error: the following arguments are required: command' in err
assert 'error: the following arguments are required: command' in err

View File

@ -27,8 +27,9 @@ def test_download_works_for_examples(runner):
fout = io.BytesIO()
fout.close = lambda: None
with patch('bonobo.commands.download._open_url') as mock_open_url, \
patch('bonobo.commands.download.open') as mock_open:
with patch('bonobo.commands.download._open_url') as mock_open_url, patch(
'bonobo.commands.download.open'
) as mock_open:
mock_open_url.return_value = MockResponse()
mock_open.return_value = fout
runner('download', 'examples/datasets/coffeeshops.txt')
@ -41,4 +42,4 @@ def test_download_works_for_examples(runner):
@all_runners
def test_download_fails_non_example(runner):
with pytest.raises(ValueError):
runner('download', 'something/entirely/different.txt')
runner('download', 'something/entirely/different.txt')

View File

@ -6,21 +6,14 @@ from bonobo.util.testing import EnvironmentTestCase
@pytest.fixture
def env1(tmpdir):
env_file = tmpdir.join('.env_one')
env_file.write('\n'.join((
'SECRET=unknown',
'PASSWORD=sweet',
'PATH=first',
)))
env_file.write('\n'.join(('SECRET=unknown', 'PASSWORD=sweet', 'PATH=first')))
return str(env_file)
@pytest.fixture
def env2(tmpdir):
env_file = tmpdir.join('.env_two')
env_file.write('\n'.join((
'PASSWORD=bitter',
"PATH='second'",
)))
env_file.write('\n'.join(('PASSWORD=bitter', "PATH='second'")))
return str(env_file)
@ -71,7 +64,15 @@ class TestEnvFileCombinations(EnvironmentTestCase):
def test_run_with_both_env_files_then_overrides(self, runner, target, env1, env2):
env = self.run_environ(
runner, *target, '--default-env-file', env1, '--env-file', env2, '--env', 'PASSWORD=mine', '--env',
runner,
*target,
'--default-env-file',
env1,
'--env-file',
env2,
'--env',
'PASSWORD=mine',
'--env',
'SECRET=s3cr3t'
)
assert env.get('SECRET') == 's3cr3t'

View File

@ -17,4 +17,4 @@ def test_version(runner):
out, err = runner('version', '-qq')
out = out.strip()
assert not out.startswith('bonobo ')
assert __version__ in out
assert __version__ in out