diff options
-rw-r--r-- | tests/cachekey/cachekey.py | 2 | ||||
-rw-r--r-- | tests/format/dependencies.py | 56 | ||||
-rw-r--r-- | tests/format/junctions.py | 32 | ||||
-rw-r--r-- | tests/format/project.py | 10 | ||||
-rw-r--r-- | tests/frontend/logging.py | 4 | ||||
-rw-r--r-- | tests/frontend/main.py | 12 | ||||
-rw-r--r-- | tests/frontend/workspace.py | 14 | ||||
-rw-r--r-- | tests/internals/context.py | 44 | ||||
-rw-r--r-- | tests/internals/loader.py | 16 | ||||
-rw-r--r-- | tests/internals/pluginfactory.py | 34 | ||||
-rw-r--r-- | tests/internals/pluginloading.py | 4 | ||||
-rw-r--r-- | tests/internals/storage.py | 10 | ||||
-rw-r--r-- | tests/internals/yaml.py | 34 | ||||
-rw-r--r-- | tests/sources/deb.py | 6 | ||||
-rw-r--r-- | tests/sources/local.py | 18 | ||||
-rw-r--r-- | tests/sources/patch.py | 8 | ||||
-rw-r--r-- | tests/sources/remote.py | 16 | ||||
-rw-r--r-- | tests/sources/tar.py | 12 | ||||
-rw-r--r-- | tests/sources/zip.py | 8 | ||||
-rw-r--r-- | tests/testutils/http_server.py | 2 | ||||
-rw-r--r-- | tests/testutils/setuptools.py | 6 |
21 files changed, 174 insertions, 174 deletions
diff --git a/tests/cachekey/cachekey.py b/tests/cachekey/cachekey.py index 7d2a13e07..1a78e56b3 100644 --- a/tests/cachekey/cachekey.py +++ b/tests/cachekey/cachekey.py @@ -58,7 +58,7 @@ def element_filename(project_dir, element_name, alt_suffix=None): if alt_suffix: # Just in case... - assert(element_name.endswith('.bst')) + assert element_name.endswith('.bst') # Chop off the 'bst' in '.bst' and add the new suffix element_name = element_name[:-3] diff --git a/tests/format/dependencies.py b/tests/format/dependencies.py index 5513077ee..8557ef64e 100644 --- a/tests/format/dependencies.py +++ b/tests/format/dependencies.py @@ -144,15 +144,15 @@ def test_scope_all(cli, datafiles): element_list = cli.get_pipeline(project, elements, scope='all') - assert(len(element_list) == 7) + assert len(element_list) == 7 - assert(element_list[0] == "build-build.bst") - assert(element_list[1] == "run-build.bst") - assert(element_list[2] == "build.bst") - assert(element_list[3] == "dep-one.bst") - assert(element_list[4] == "run.bst") - assert(element_list[5] == "dep-two.bst") - assert(element_list[6] == "target.bst") + assert element_list[0] == "build-build.bst" + assert element_list[1] == "run-build.bst" + assert element_list[2] == "build.bst" + assert element_list[3] == "dep-one.bst" + assert element_list[4] == "run.bst" + assert element_list[5] == "dep-two.bst" + assert element_list[6] == "target.bst" @pytest.mark.datafiles(DATA_DIR) @@ -162,12 +162,12 @@ def test_scope_run(cli, datafiles): element_list = cli.get_pipeline(project, elements, scope='run') - assert(len(element_list) == 4) + assert len(element_list) == 4 - assert(element_list[0] == "dep-one.bst") - assert(element_list[1] == "run.bst") - assert(element_list[2] == "dep-two.bst") - assert(element_list[3] == "target.bst") + assert element_list[0] == "dep-one.bst" + assert element_list[1] == "run.bst" + assert element_list[2] == "dep-two.bst" + assert element_list[3] == "target.bst" @pytest.mark.datafiles(DATA_DIR) @@ -177,11 +177,11 @@ def test_scope_build(cli, datafiles): element_list = cli.get_pipeline(project, elements, scope='build') - assert(len(element_list) == 3) + assert len(element_list) == 3 - assert(element_list[0] == "dep-one.bst") - assert(element_list[1] == "run.bst") - assert(element_list[2] == "dep-two.bst") + assert element_list[0] == "dep-one.bst" + assert element_list[1] == "run.bst" + assert element_list[2] == "dep-two.bst" @pytest.mark.datafiles(DATA_DIR) @@ -197,10 +197,10 @@ def test_scope_build_of_child(cli, datafiles): # Pass two, let's look at these element_list = cli.get_pipeline(project, [element], scope='build') - assert(len(element_list) == 2) + assert len(element_list) == 2 - assert(element_list[0] == "run-build.bst") - assert(element_list[1] == "build.bst") + assert element_list[0] == "run-build.bst" + assert element_list[1] == "build.bst" @pytest.mark.datafiles(DATA_DIR) @@ -213,12 +213,12 @@ def test_no_recurse(cli, datafiles): # show` option does this directly. element_list = cli.get_pipeline(project, elements, scope='plan') - assert(len(element_list) == 7) + assert len(element_list) == 7 - assert(element_list[0] == 'build-build.bst') - assert(element_list[1] in ['build.bst', 'run-build.bst']) - assert(element_list[2] in ['build.bst', 'run-build.bst']) - assert(element_list[3] in ['dep-one.bst', 'run.bst', 'dep-two.bst']) - assert(element_list[4] in ['dep-one.bst', 'run.bst', 'dep-two.bst']) - assert(element_list[5] in ['dep-one.bst', 'run.bst', 'dep-two.bst']) - assert(element_list[6] == 'target.bst') + assert element_list[0] == 'build-build.bst' + assert element_list[1] in ['build.bst', 'run-build.bst'] + assert element_list[2] in ['build.bst', 'run-build.bst'] + assert element_list[3] in ['dep-one.bst', 'run.bst', 'dep-two.bst'] + assert element_list[4] in ['dep-one.bst', 'run.bst', 'dep-two.bst'] + assert element_list[5] in ['dep-one.bst', 'run.bst', 'dep-two.bst'] + assert element_list[6] == 'target.bst' diff --git a/tests/format/junctions.py b/tests/format/junctions.py index e86ef2082..671cac15f 100644 --- a/tests/format/junctions.py +++ b/tests/format/junctions.py @@ -45,8 +45,8 @@ def test_simple_build(cli, tmpdir, datafiles): result.assert_success() # Check that the checkout contains the expected files from both projects - assert(os.path.exists(os.path.join(checkoutdir, 'base.txt'))) - assert(os.path.exists(os.path.join(checkoutdir, 'foo.txt'))) + assert os.path.exists(os.path.join(checkoutdir, 'base.txt')) + assert os.path.exists(os.path.join(checkoutdir, 'foo.txt')) @pytest.mark.datafiles(DATA_DIR) @@ -157,8 +157,8 @@ def test_nested_simple(cli, tmpdir, datafiles): result.assert_success() # Check that the checkout contains the expected files from all subprojects - assert(os.path.exists(os.path.join(checkoutdir, 'base.txt'))) - assert(os.path.exists(os.path.join(checkoutdir, 'foo.txt'))) + assert os.path.exists(os.path.join(checkoutdir, 'base.txt')) + assert os.path.exists(os.path.join(checkoutdir, 'foo.txt')) @pytest.mark.datafiles(DATA_DIR) @@ -181,9 +181,9 @@ def test_nested_double(cli, tmpdir, datafiles): result.assert_success() # Check that the checkout contains the expected files from all subprojects - assert(os.path.exists(os.path.join(checkoutdir, 'base.txt'))) - assert(os.path.exists(os.path.join(checkoutdir, 'foo.txt'))) - assert(os.path.exists(os.path.join(checkoutdir, 'bar.txt'))) + assert os.path.exists(os.path.join(checkoutdir, 'base.txt')) + assert os.path.exists(os.path.join(checkoutdir, 'foo.txt')) + assert os.path.exists(os.path.join(checkoutdir, 'bar.txt')) @pytest.mark.datafiles(DATA_DIR) @@ -253,8 +253,8 @@ def test_options_default(cli, tmpdir, datafiles): result = cli.run(project=project, args=['artifact', 'checkout', 'target.bst', '--directory', checkoutdir]) result.assert_success() - assert(os.path.exists(os.path.join(checkoutdir, 'pony.txt'))) - assert(not os.path.exists(os.path.join(checkoutdir, 'horsy.txt'))) + assert os.path.exists(os.path.join(checkoutdir, 'pony.txt')) + assert not os.path.exists(os.path.join(checkoutdir, 'horsy.txt')) @pytest.mark.datafiles(DATA_DIR) @@ -270,8 +270,8 @@ def test_options(cli, tmpdir, datafiles): result = cli.run(project=project, args=['artifact', 'checkout', 'target.bst', '--directory', checkoutdir]) result.assert_success() - assert(not os.path.exists(os.path.join(checkoutdir, 'pony.txt'))) - assert(os.path.exists(os.path.join(checkoutdir, 'horsy.txt'))) + assert not os.path.exists(os.path.join(checkoutdir, 'pony.txt')) + assert os.path.exists(os.path.join(checkoutdir, 'horsy.txt')) @pytest.mark.datafiles(DATA_DIR) @@ -287,8 +287,8 @@ def test_options_inherit(cli, tmpdir, datafiles): result = cli.run(project=project, args=['artifact', 'checkout', 'target.bst', '--directory', checkoutdir]) result.assert_success() - assert(not os.path.exists(os.path.join(checkoutdir, 'pony.txt'))) - assert(os.path.exists(os.path.join(checkoutdir, 'horsy.txt'))) + assert not os.path.exists(os.path.join(checkoutdir, 'pony.txt')) + assert os.path.exists(os.path.join(checkoutdir, 'horsy.txt')) @pytest.mark.skipif(HAVE_GIT is False, reason="git is not available") @@ -348,8 +348,8 @@ def test_git_build(cli, tmpdir, datafiles): result.assert_success() # Check that the checkout contains the expected files from both projects - assert(os.path.exists(os.path.join(checkoutdir, 'base.txt'))) - assert(os.path.exists(os.path.join(checkoutdir, 'foo.txt'))) + assert os.path.exists(os.path.join(checkoutdir, 'base.txt')) + assert os.path.exists(os.path.join(checkoutdir, 'foo.txt')) @pytest.mark.skipif(HAVE_GIT is False, reason="git is not available") @@ -415,4 +415,4 @@ def test_build_git_cross_junction_names(cli, tmpdir, datafiles): result.assert_success() # Check that the checkout contains the expected files from both projects - assert(os.path.exists(os.path.join(checkoutdir, 'base.txt'))) + assert os.path.exists(os.path.join(checkoutdir, 'base.txt')) diff --git a/tests/format/project.py b/tests/format/project.py index 0f29cac1e..ee621a162 100644 --- a/tests/format/project.py +++ b/tests/format/project.py @@ -79,8 +79,8 @@ def test_load_default_project(cli, datafiles): # Read back some of our project defaults from the env env = _yaml.load_data(result.output) - assert (env['USER'] == "tomjon") - assert (env['TERM'] == "dumb") + assert env['USER'] == "tomjon" + assert env['TERM'] == "dumb" @pytest.mark.datafiles(os.path.join(DATA_DIR)) @@ -94,8 +94,8 @@ def test_load_project_from_subdir(cli, datafiles): # Read back some of our project defaults from the env env = _yaml.load_data(result.output) - assert (env['USER'] == "tomjon") - assert (env['TERM'] == "dumb") + assert env['USER'] == "tomjon" + assert env['TERM'] == "dumb" @pytest.mark.datafiles(os.path.join(DATA_DIR)) @@ -108,7 +108,7 @@ def test_override_project_path(cli, datafiles): # Read back the overridden path env = _yaml.load_data(result.output) - assert (env['PATH'] == "/bin:/sbin") + assert env['PATH'] == "/bin:/sbin" @pytest.mark.datafiles(os.path.join(DATA_DIR)) diff --git a/tests/frontend/logging.py b/tests/frontend/logging.py index e75901c23..1fbd57e7d 100644 --- a/tests/frontend/logging.py +++ b/tests/frontend/logging.py @@ -45,7 +45,7 @@ def test_default_logging(cli, tmpdir, datafiles): result.assert_success() m = re.search(r"\[\d\d:\d\d:\d\d\]\[\s*\]\[.*\] SUCCESS Checking sources", result.stderr) - assert(m is not None) + assert m is not None @pytest.mark.datafiles(DATA_DIR) @@ -83,7 +83,7 @@ def test_custom_logging(cli, tmpdir, datafiles): m = re.search(r"\d\d:\d\d:\d\d,\d\d:\d\d:\d\d.\d{6},\d\d:\d\d:\d\d,\d\d:\d\d:\d\d.\d{6}\s*,.*" r",SUCCESS,Checking sources", result.stderr) - assert(m is not None) + assert m is not None @pytest.mark.datafiles(DATA_DIR) diff --git a/tests/frontend/main.py b/tests/frontend/main.py index 03b8840ff..7fefb7429 100644 --- a/tests/frontend/main.py +++ b/tests/frontend/main.py @@ -7,22 +7,22 @@ from buildstream._frontend.app import _prefix_choice_value_proc def test_prefix_choice_value_proc_full_match(): value_proc = _prefix_choice_value_proc(['foo', 'bar', 'baz']) - assert("foo" == value_proc("foo")) - assert("bar" == value_proc("bar")) - assert("baz" == value_proc("baz")) + assert "foo" == value_proc("foo") + assert "bar" == value_proc("bar") + assert "baz" == value_proc("baz") def test_prefix_choice_value_proc_prefix_match(): value_proc = _prefix_choice_value_proc(['foo']) - assert ("foo" == value_proc("f")) + assert "foo" == value_proc("f") def test_prefix_choice_value_proc_ambigous_match(): value_proc = _prefix_choice_value_proc(['bar', 'baz']) - assert ("bar" == value_proc("bar")) - assert ("baz" == value_proc("baz")) + assert "bar" == value_proc("bar") + assert "baz" == value_proc("baz") with pytest.raises(click.UsageError): value_proc("ba") diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py index f1fa13df0..1a8119124 100644 --- a/tests/frontend/workspace.py +++ b/tests/frontend/workspace.py @@ -177,7 +177,7 @@ def test_open_bzr_customize(cli, tmpdir, datafiles): # Check that the .bzr dir exists bzrdir = os.path.join(workspace, ".bzr") - assert(os.path.isdir(bzrdir)) + assert os.path.isdir(bzrdir) # Check that the correct origin branch is set element_config = _yaml.load(os.path.join(project, "elements", element_name)) @@ -186,7 +186,7 @@ def test_open_bzr_customize(cli, tmpdir, datafiles): stripped_url = source_config['url'].lstrip("file:///") expected_output_str = ("checkout of branch: /{}/{}" .format(stripped_url, source_config['track'])) - assert(expected_output_str in str(output)) + assert expected_output_str in str(output) @pytest.mark.datafiles(DATA_DIR) @@ -199,12 +199,12 @@ def test_open_multi(cli, tmpdir, datafiles): assert kind in elname workspace_lsdir = os.listdir(workspace) if kind == 'git': - assert('.git' in workspace_lsdir) + assert '.git' in workspace_lsdir elif kind == 'bzr': - assert('.bzr' in workspace_lsdir) + assert '.bzr' in workspace_lsdir else: - assert not ('.git' in workspace_lsdir) - assert not ('.bzr' in workspace_lsdir) + assert not '.git' in workspace_lsdir + assert not '.bzr' in workspace_lsdir @pytest.mark.skipif(os.geteuid() == 0, reason="root may have CAP_DAC_OVERRIDE and ignore permissions") @@ -232,7 +232,7 @@ def test_open_multi_unwritable(cli, tmpdir, datafiles): result.assert_main_error(ErrorDomain.STREAM, None) # Normally we avoid checking stderr in favour of using the mechine readable result.assert_main_error # But Tristan was very keen that the names of the elements left needing workspaces were present in the out put - assert (" ".join([element_name for element_name, workspace_dir_suffix in element_tuples[1:]]) in result.stderr) + assert " ".join([element_name for element_name, workspace_dir_suffix in element_tuples[1:]]) in result.stderr @pytest.mark.datafiles(DATA_DIR) diff --git a/tests/internals/context.py b/tests/internals/context.py index 17d950f85..cf9d4f4c4 100644 --- a/tests/internals/context.py +++ b/tests/internals/context.py @@ -29,7 +29,7 @@ def context_fixture(): ####################################### def test_context_create(context_fixture): context = context_fixture['context'] - assert(isinstance(context, Context)) + assert isinstance(context, Context) ####################################### @@ -38,13 +38,13 @@ def test_context_create(context_fixture): def test_context_load(context_fixture): context = context_fixture['context'] cache_home = context_fixture['xdg-cache'] - assert(isinstance(context, Context)) + assert isinstance(context, Context) context.load(config=os.devnull) - assert(context.sourcedir == os.path.join(cache_home, 'buildstream', 'sources')) - assert(context.builddir == os.path.join(cache_home, 'buildstream', 'build')) - assert(context.cachedir == os.path.join(cache_home, 'buildstream')) - assert(context.logdir == os.path.join(cache_home, 'buildstream', 'logs')) + assert context.sourcedir == os.path.join(cache_home, 'buildstream', 'sources') + assert context.builddir == os.path.join(cache_home, 'buildstream', 'build') + assert context.cachedir == os.path.join(cache_home, 'buildstream') + assert context.logdir == os.path.join(cache_home, 'buildstream', 'logs') # Assert that a changed XDG_CACHE_HOME doesn't cause issues @@ -52,13 +52,13 @@ def test_context_load_envvar(context_fixture): os.environ['XDG_CACHE_HOME'] = '/some/path/' context = context_fixture['context'] - assert(isinstance(context, Context)) + assert isinstance(context, Context) context.load(config=os.devnull) - assert(context.sourcedir == os.path.join('/', 'some', 'path', 'buildstream', 'sources')) - assert(context.builddir == os.path.join('/', 'some', 'path', 'buildstream', 'build')) - assert(context.cachedir == os.path.join('/', 'some', 'path', 'buildstream')) - assert(context.logdir == os.path.join('/', 'some', 'path', 'buildstream', 'logs')) + assert context.sourcedir == os.path.join('/', 'some', 'path', 'buildstream', 'sources') + assert context.builddir == os.path.join('/', 'some', 'path', 'buildstream', 'build') + assert context.cachedir == os.path.join('/', 'some', 'path', 'buildstream') + assert context.logdir == os.path.join('/', 'some', 'path', 'buildstream', 'logs') # Reset the environment variable del os.environ['XDG_CACHE_HOME'] @@ -70,17 +70,17 @@ def test_context_load_envvar(context_fixture): def test_context_load_user_config(context_fixture, datafiles): context = context_fixture['context'] cache_home = context_fixture['xdg-cache'] - assert(isinstance(context, Context)) + assert isinstance(context, Context) conf_file = os.path.join(datafiles.dirname, datafiles.basename, 'userconf.yaml') context.load(conf_file) - assert(context.sourcedir == os.path.expanduser('~/pony')) - assert(context.builddir == os.path.join(cache_home, 'buildstream', 'build')) - assert(context.cachedir == os.path.join(cache_home, 'buildstream')) - assert(context.logdir == os.path.join(cache_home, 'buildstream', 'logs')) + assert context.sourcedir == os.path.expanduser('~/pony') + assert context.builddir == os.path.join(cache_home, 'buildstream', 'build') + assert context.cachedir == os.path.join(cache_home, 'buildstream') + assert context.logdir == os.path.join(cache_home, 'buildstream', 'logs') ####################################### @@ -89,7 +89,7 @@ def test_context_load_user_config(context_fixture, datafiles): @pytest.mark.datafiles(os.path.join(DATA_DIR)) def test_context_load_missing_config(context_fixture, datafiles): context = context_fixture['context'] - assert(isinstance(context, Context)) + assert isinstance(context, Context) conf_file = os.path.join(datafiles.dirname, datafiles.basename, @@ -98,13 +98,13 @@ def test_context_load_missing_config(context_fixture, datafiles): with pytest.raises(LoadError) as exc: context.load(conf_file) - assert (exc.value.reason == LoadErrorReason.MISSING_FILE) + assert exc.value.reason == LoadErrorReason.MISSING_FILE @pytest.mark.datafiles(os.path.join(DATA_DIR)) def test_context_load_malformed_config(context_fixture, datafiles): context = context_fixture['context'] - assert(isinstance(context, Context)) + assert isinstance(context, Context) conf_file = os.path.join(datafiles.dirname, datafiles.basename, @@ -113,13 +113,13 @@ def test_context_load_malformed_config(context_fixture, datafiles): with pytest.raises(LoadError) as exc: context.load(conf_file) - assert (exc.value.reason == LoadErrorReason.INVALID_YAML) + assert exc.value.reason == LoadErrorReason.INVALID_YAML @pytest.mark.datafiles(os.path.join(DATA_DIR)) def test_context_load_notdict_config(context_fixture, datafiles): context = context_fixture['context'] - assert(isinstance(context, Context)) + assert isinstance(context, Context) conf_file = os.path.join(datafiles.dirname, datafiles.basename, @@ -129,4 +129,4 @@ def test_context_load_notdict_config(context_fixture, datafiles): context.load(conf_file) # XXX Should this be a different LoadErrorReason ? - assert (exc.value.reason == LoadErrorReason.INVALID_YAML) + assert exc.value.reason == LoadErrorReason.INVALID_YAML diff --git a/tests/internals/loader.py b/tests/internals/loader.py index a04f596c5..7663d03e3 100644 --- a/tests/internals/loader.py +++ b/tests/internals/loader.py @@ -36,8 +36,8 @@ def test_one_file(datafiles): element = loader.load(['elements/onefile.bst'])[0] - assert(isinstance(element, MetaElement)) - assert(element.kind == 'pony') + assert isinstance(element, MetaElement) + assert element.kind == 'pony' @pytest.mark.datafiles(os.path.join(DATA_DIR, 'onefile')) @@ -49,7 +49,7 @@ def test_missing_file(datafiles): with pytest.raises(LoadError) as exc: loader.load(['elements/missing.bst']) - assert (exc.value.reason == LoadErrorReason.MISSING_FILE) + assert exc.value.reason == LoadErrorReason.MISSING_FILE @pytest.mark.datafiles(os.path.join(DATA_DIR, 'onefile')) @@ -61,7 +61,7 @@ def test_invalid_reference(datafiles): with pytest.raises(LoadError) as exc: loader.load(['elements/badreference.bst']) - assert (exc.value.reason == LoadErrorReason.INVALID_YAML) + assert exc.value.reason == LoadErrorReason.INVALID_YAML @pytest.mark.datafiles(os.path.join(DATA_DIR, 'onefile')) @@ -73,7 +73,7 @@ def test_invalid_yaml(datafiles): with pytest.raises(LoadError) as exc: loader.load(['elements/badfile.bst']) - assert (exc.value.reason == LoadErrorReason.INVALID_YAML) + assert exc.value.reason == LoadErrorReason.INVALID_YAML @pytest.mark.datafiles(os.path.join(DATA_DIR, 'onefile')) @@ -86,7 +86,7 @@ def test_fail_fullpath_target(datafiles): loader = make_loader(basedir) loader.load([fullpath]) - assert (exc.value.reason == LoadErrorReason.INVALID_DATA) + assert exc.value.reason == LoadErrorReason.INVALID_DATA @pytest.mark.datafiles(os.path.join(DATA_DIR, 'onefile')) @@ -98,7 +98,7 @@ def test_invalid_key(datafiles): with pytest.raises(LoadError) as exc: loader.load(['elements/invalidkey.bst']) - assert (exc.value.reason == LoadErrorReason.INVALID_DATA) + assert exc.value.reason == LoadErrorReason.INVALID_DATA @pytest.mark.datafiles(os.path.join(DATA_DIR, 'onefile')) @@ -110,4 +110,4 @@ def test_invalid_directory_load(datafiles): with pytest.raises(LoadError) as exc: loader.load(['elements/']) - assert (exc.value.reason == LoadErrorReason.LOADING_DIRECTORY) + assert exc.value.reason == LoadErrorReason.LOADING_DIRECTORY diff --git a/tests/internals/pluginfactory.py b/tests/internals/pluginfactory.py index ec4516736..ec30c8b0a 100644 --- a/tests/internals/pluginfactory.py +++ b/tests/internals/pluginfactory.py @@ -25,17 +25,17 @@ def plugin_fixture(): # Basics: test the fixture, test we can create the factories # ############################################################## def test_fixture(plugin_fixture): - assert(isinstance(plugin_fixture['base'], PluginBase)) + assert isinstance(plugin_fixture['base'], PluginBase) def test_source_factory(plugin_fixture): factory = SourceFactory(plugin_fixture['base']) - assert(isinstance(factory, SourceFactory)) + assert isinstance(factory, SourceFactory) def test_element_factory(plugin_fixture): factory = ElementFactory(plugin_fixture['base']) - assert(isinstance(factory, ElementFactory)) + assert isinstance(factory, ElementFactory) ############################################################## @@ -50,10 +50,10 @@ def test_custom_source(plugin_fixture, datafiles): 'plugins': {'foo': 0} }] factory = SourceFactory(plugin_fixture['base'], plugin_origins=plugins) - assert(isinstance(factory, SourceFactory)) + assert isinstance(factory, SourceFactory) foo_type, _ = factory.lookup('foo') - assert(foo_type.__name__ == 'FooSource') + assert foo_type.__name__ == 'FooSource' @pytest.mark.datafiles(os.path.join(DATA_DIR, 'customelement')) @@ -65,10 +65,10 @@ def test_custom_element(plugin_fixture, datafiles): 'plugins': {'foo': 0} }] factory = ElementFactory(plugin_fixture['base'], plugin_origins=plugins) - assert(isinstance(factory, ElementFactory)) + assert isinstance(factory, ElementFactory) foo_type, _ = factory.lookup('foo') - assert(foo_type.__name__ == 'FooElement') + assert foo_type.__name__ == 'FooElement' ############################################################## @@ -76,7 +76,7 @@ def test_custom_element(plugin_fixture, datafiles): ############################################################## def test_missing_source(plugin_fixture): factory = SourceFactory(plugin_fixture['base']) - assert(isinstance(factory, SourceFactory)) + assert isinstance(factory, SourceFactory) # Test fails if PluginError is not raised with pytest.raises(PluginError): @@ -85,7 +85,7 @@ def test_missing_source(plugin_fixture): def test_missing_element(plugin_fixture): factory = ElementFactory(plugin_fixture['base']) - assert(isinstance(factory, ElementFactory)) + assert isinstance(factory, ElementFactory) # Test fails if PluginError is not raised with pytest.raises(PluginError): @@ -262,13 +262,13 @@ def test_source_multicontext(plugin_fixture, datafiles): factory1 = SourceFactory(plugin_fixture['base'], plugin_origins=[plugins1]) factory2 = SourceFactory(plugin_fixture['base'], plugin_origins=[plugins2]) - assert(isinstance(factory1, SourceFactory)) - assert(isinstance(factory2, SourceFactory)) + assert isinstance(factory1, SourceFactory) + assert isinstance(factory2, SourceFactory) foo_type1, _ = factory1.lookup('foo') foo_type2, _ = factory2.lookup('foo') - assert(foo_type1.__name__ == 'FooSource') - assert(foo_type2.__name__ == 'AnotherFooSource') + assert foo_type1.__name__ == 'FooSource' + assert foo_type2.__name__ == 'AnotherFooSource' # Load two factories, both of which define a different 'foo' plugin @@ -291,10 +291,10 @@ def test_element_multicontext(plugin_fixture, datafiles): factory1 = ElementFactory(plugin_fixture['base'], plugin_origins=[plugins1]) factory2 = ElementFactory(plugin_fixture['base'], plugin_origins=[plugins2]) - assert(isinstance(factory1, ElementFactory)) - assert(isinstance(factory2, ElementFactory)) + assert isinstance(factory1, ElementFactory) + assert isinstance(factory2, ElementFactory) foo_type1, _ = factory1.lookup('foo') foo_type2, _ = factory2.lookup('foo') - assert(foo_type1.__name__ == 'FooElement') - assert(foo_type2.__name__ == 'AnotherFooElement') + assert foo_type1.__name__ == 'FooElement' + assert foo_type2.__name__ == 'AnotherFooElement' diff --git a/tests/internals/pluginloading.py b/tests/internals/pluginloading.py index e14071718..675ac8540 100644 --- a/tests/internals/pluginloading.py +++ b/tests/internals/pluginloading.py @@ -34,7 +34,7 @@ def test_customsource(datafiles, tmpdir): basedir = os.path.join(datafiles.dirname, datafiles.basename) targets = create_pipeline(tmpdir, basedir, 'simple.bst') - assert(targets[0].get_kind() == "autotools") + assert targets[0].get_kind() == "autotools" @pytest.mark.datafiles(os.path.join(DATA_DIR, 'customelement')) @@ -42,7 +42,7 @@ def test_customelement(datafiles, tmpdir): basedir = os.path.join(datafiles.dirname, datafiles.basename) targets = create_pipeline(tmpdir, basedir, 'simple.bst') - assert(targets[0].get_kind() == "foo") + assert targets[0].get_kind() == "foo" @pytest.mark.datafiles(os.path.join(DATA_DIR, 'badversionsource')) diff --git a/tests/internals/storage.py b/tests/internals/storage.py index 36d9442c5..66423afd1 100644 --- a/tests/internals/storage.py +++ b/tests/internals/storage.py @@ -30,8 +30,8 @@ def test_import(tmpdir, datafiles, backend): c.import_files(original) - assert("bin/bash" in c.list_relative_paths()) - assert("bin/hello" in c.list_relative_paths()) + assert "bin/bash" in c.list_relative_paths() + assert "bin/hello" in c.list_relative_paths() @pytest.mark.parametrize("backend", [ @@ -50,6 +50,6 @@ def test_modified_file_list(tmpdir, datafiles, backend): c.import_files(overlay) print("List of all paths in imported results: {}".format(c.list_relative_paths())) - assert("bin/bash" in c.list_relative_paths()) - assert("bin/bash" in c.list_modified_paths()) - assert("bin/hello" not in c.list_modified_paths()) + assert "bin/bash" in c.list_relative_paths() + assert "bin/bash" in c.list_modified_paths() + assert "bin/hello" not in c.list_modified_paths() diff --git a/tests/internals/yaml.py b/tests/internals/yaml.py index 4870b5180..31e788872 100644 --- a/tests/internals/yaml.py +++ b/tests/internals/yaml.py @@ -23,7 +23,7 @@ def test_load_yaml(datafiles): 'basics.yaml') loaded = _yaml.load(filename) - assert(loaded.get('kind') == 'pony') + assert loaded.get('kind') == 'pony' def assert_provenance(filename, line, col, node, key=None, indices=[]): @@ -31,15 +31,15 @@ def assert_provenance(filename, line, col, node, key=None, indices=[]): if key: if indices: - assert(isinstance(provenance, _yaml.ElementProvenance)) + assert isinstance(provenance, _yaml.ElementProvenance) else: - assert(isinstance(provenance, _yaml.MemberProvenance)) + assert isinstance(provenance, _yaml.MemberProvenance) else: - assert(isinstance(provenance, _yaml.DictProvenance)) + assert isinstance(provenance, _yaml.DictProvenance) - assert(provenance.filename.shortname == filename) - assert(provenance.line == line) - assert(provenance.col == col) + assert provenance.filename.shortname == filename + assert provenance.line == line + assert provenance.col == col @pytest.mark.datafiles(os.path.join(DATA_DIR)) @@ -50,7 +50,7 @@ def test_basic_provenance(datafiles): 'basics.yaml') loaded = _yaml.load(filename) - assert(loaded.get('kind') == 'pony') + assert loaded.get('kind') == 'pony' assert_provenance(filename, 1, 0, loaded) @@ -63,7 +63,7 @@ def test_member_provenance(datafiles): 'basics.yaml') loaded = _yaml.load(filename) - assert(loaded.get('kind') == 'pony') + assert loaded.get('kind') == 'pony' assert_provenance(filename, 2, 13, loaded, 'description') @@ -75,7 +75,7 @@ def test_element_provenance(datafiles): 'basics.yaml') loaded = _yaml.load(filename) - assert(loaded.get('kind') == 'pony') + assert loaded.get('kind') == 'pony' assert_provenance(filename, 5, 2, loaded, 'moods', [1]) @@ -98,7 +98,7 @@ def test_node_validate(datafiles): with pytest.raises(LoadError) as exc: _yaml.node_validate(base, ['kind', 'description', 'moods', 'children', 'extra']) - assert (exc.value.reason == LoadErrorReason.INVALID_DATA) + assert exc.value.reason == LoadErrorReason.INVALID_DATA @pytest.mark.datafiles(os.path.join(DATA_DIR)) @@ -109,11 +109,11 @@ def test_node_get(datafiles): 'basics.yaml') base = _yaml.load(filename) - assert(base.get('kind') == 'pony') + assert base.get('kind') == 'pony' children = _yaml.node_get(base, list, 'children') - assert(isinstance(children, list)) - assert(len(children) == 7) + assert isinstance(children, list) + assert len(children) == 7 child = _yaml.node_get(base, Mapping, 'children', indices=[6]) assert_provenance(filename, 20, 8, child, 'mood') @@ -122,7 +122,7 @@ def test_node_get(datafiles): with pytest.raises(LoadError) as exc: _yaml.node_get(extra, Mapping, 'old') - assert (exc.value.reason == LoadErrorReason.INVALID_DATA) + assert exc.value.reason == LoadErrorReason.INVALID_DATA # Really this is testing _yaml.node_copy(), we want to @@ -148,10 +148,10 @@ def test_composite_preserve_originals(datafiles): orig_extra = _yaml.node_get(base, Mapping, 'extra') # Test that the node copy has the overridden value... - assert(_yaml.node_get(copy_extra, str, 'old') == 'override') + assert _yaml.node_get(copy_extra, str, 'old') == 'override' # But the original node is not effected by the override. - assert(_yaml.node_get(orig_extra, str, 'old') == 'new') + assert _yaml.node_get(orig_extra, str, 'old') == 'new' def load_yaml_file(filename, *, cache_path, shortname=None, from_cache='raw'): diff --git a/tests/sources/deb.py b/tests/sources/deb.py index 684c9e961..554110319 100644 --- a/tests/sources/deb.py +++ b/tests/sources/deb.py @@ -118,7 +118,7 @@ def test_stage_default_basedir(cli, tmpdir, datafiles): original_dir = os.path.join(str(datafiles), "content") original_contents = list_dir_contents(original_dir) checkout_contents = list_dir_contents(checkoutdir) - assert(checkout_contents == original_contents) + assert checkout_contents == original_contents # Test that a staged checkout matches what was tarred up, with an empty base-dir @@ -146,7 +146,7 @@ def test_stage_no_basedir(cli, tmpdir, datafiles): original_dir = os.path.join(str(datafiles), "content") original_contents = list_dir_contents(original_dir) checkout_contents = list_dir_contents(checkoutdir) - assert(checkout_contents == original_contents) + assert checkout_contents == original_contents # Test that a staged checkout matches what was tarred up, with an explicit basedir @@ -174,4 +174,4 @@ def test_stage_explicit_basedir(cli, tmpdir, datafiles): original_dir = os.path.join(str(datafiles), "content") original_contents = list_dir_contents(original_dir) checkout_contents = list_dir_contents(checkoutdir) - assert(checkout_contents == original_contents) + assert checkout_contents == original_contents diff --git a/tests/sources/local.py b/tests/sources/local.py index c494e2671..7df1cd9ea 100644 --- a/tests/sources/local.py +++ b/tests/sources/local.py @@ -82,7 +82,7 @@ def test_stage_file(cli, tmpdir, datafiles): result.assert_success() # Check that the checkout contains the expected file - assert(os.path.exists(os.path.join(checkoutdir, 'file.txt'))) + assert os.path.exists(os.path.join(checkoutdir, 'file.txt')) @pytest.mark.datafiles(os.path.join(DATA_DIR, 'directory')) @@ -97,8 +97,8 @@ def test_stage_directory(cli, tmpdir, datafiles): result.assert_success() # Check that the checkout contains the expected file and directory and other file - assert(os.path.exists(os.path.join(checkoutdir, 'file.txt'))) - assert(os.path.exists(os.path.join(checkoutdir, 'subdir', 'anotherfile.txt'))) + assert os.path.exists(os.path.join(checkoutdir, 'file.txt')) + assert os.path.exists(os.path.join(checkoutdir, 'subdir', 'anotherfile.txt')) @pytest.mark.datafiles(os.path.join(DATA_DIR, 'symlink')) @@ -122,9 +122,9 @@ def test_stage_symlink(cli, tmpdir, datafiles): result.assert_success() # Check that the checkout contains the expected file and directory and other file - assert(os.path.exists(os.path.join(checkoutdir, 'file.txt'))) - assert(os.path.exists(os.path.join(checkoutdir, 'symlink-to-file.txt'))) - assert(os.path.islink(os.path.join(checkoutdir, 'symlink-to-file.txt'))) + assert os.path.exists(os.path.join(checkoutdir, 'file.txt')) + assert os.path.exists(os.path.join(checkoutdir, 'symlink-to-file.txt')) + assert os.path.islink(os.path.join(checkoutdir, 'symlink-to-file.txt')) @pytest.mark.datafiles(os.path.join(DATA_DIR, 'file-exists')) @@ -152,6 +152,6 @@ def test_stage_directory_symlink(cli, tmpdir, datafiles): result.assert_success() # Check that the checkout contains the expected directory and directory symlink - assert(os.path.exists(os.path.join(checkoutdir, 'subdir', 'anotherfile.txt'))) - assert(os.path.exists(os.path.join(checkoutdir, 'symlink-to-subdir', 'anotherfile.txt'))) - assert(os.path.islink(os.path.join(checkoutdir, 'symlink-to-subdir'))) + assert os.path.exists(os.path.join(checkoutdir, 'subdir', 'anotherfile.txt')) + assert os.path.exists(os.path.join(checkoutdir, 'symlink-to-subdir', 'anotherfile.txt')) + assert os.path.islink(os.path.join(checkoutdir, 'symlink-to-subdir')) diff --git a/tests/sources/patch.py b/tests/sources/patch.py index 761656580..51cdc2186 100644 --- a/tests/sources/patch.py +++ b/tests/sources/patch.py @@ -81,7 +81,7 @@ def test_stage_and_patch(cli, tmpdir, datafiles): # Test the file.txt was patched and changed with open(os.path.join(checkoutdir, 'file.txt')) as f: - assert(f.read() == 'This is text file with superpowers\n') + assert f.read() == 'This is text file with superpowers\n' @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) @@ -117,7 +117,7 @@ def test_stage_separate_patch_dir(cli, tmpdir, datafiles): # Test the file.txt was patched and changed with open(os.path.join(checkoutdir, 'test-dir', 'file.txt')) as f: - assert(f.read() == 'This is text file in a directory with superpowers\n') + assert f.read() == 'This is text file in a directory with superpowers\n' @pytest.mark.datafiles(os.path.join(DATA_DIR, 'multiple-patches')) @@ -133,7 +133,7 @@ def test_stage_multiple_patches(cli, tmpdir, datafiles): # Test the file.txt was patched and changed with open(os.path.join(checkoutdir, 'file.txt')) as f: - assert(f.read() == 'This is text file with more superpowers\n') + assert f.read() == 'This is text file with more superpowers\n' @pytest.mark.datafiles(os.path.join(DATA_DIR, 'different-strip-level')) @@ -149,4 +149,4 @@ def test_patch_strip_level(cli, tmpdir, datafiles): # Test the file.txt was patched and changed with open(os.path.join(checkoutdir, 'file.txt')) as f: - assert(f.read() == 'This is text file with superpowers\n') + assert f.read() == 'This is text file with superpowers\n' diff --git a/tests/sources/remote.py b/tests/sources/remote.py index 5ca2f79d2..48e8c3df5 100644 --- a/tests/sources/remote.py +++ b/tests/sources/remote.py @@ -95,13 +95,13 @@ def test_simple_file_build(cli, tmpdir, datafiles): # Note that the url of the file in target.bst is actually /dir/file # but this tests confirms we take the basename checkout_file = os.path.join(checkoutdir, 'file') - assert(os.path.exists(checkout_file)) + assert os.path.exists(checkout_file) mode = os.stat(checkout_file).st_mode # Assert not executable by anyone - assert(not (mode & (stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH))) + assert not mode & (stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH) # Assert not writeable by anyone other than me - assert(not (mode & (stat.S_IWGRP | stat.S_IWOTH))) + assert not mode & (stat.S_IWGRP | stat.S_IWOTH) @pytest.mark.datafiles(os.path.join(DATA_DIR, 'single-file-custom-name')) @@ -125,8 +125,8 @@ def test_simple_file_custom_name_build(cli, tmpdir, datafiles): 'artifact', 'checkout', 'target.bst', '--directory', checkoutdir ]) result.assert_success() - assert(not os.path.exists(os.path.join(checkoutdir, 'file'))) - assert(os.path.exists(os.path.join(checkoutdir, 'custom-file'))) + assert not os.path.exists(os.path.join(checkoutdir, 'file')) + assert os.path.exists(os.path.join(checkoutdir, 'custom-file')) @pytest.mark.datafiles(os.path.join(DATA_DIR, 'unique-keys')) @@ -179,9 +179,9 @@ def test_executable(cli, tmpdir, datafiles): 'artifact', 'checkout', 'target-custom-executable.bst', '--directory', checkoutdir ]) mode = os.stat(os.path.join(checkoutdir, 'some-custom-file')).st_mode - assert (mode & stat.S_IEXEC) + assert mode & stat.S_IEXEC # Assert executable by anyone - assert(mode & (stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH)) + assert mode & (stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH) @pytest.mark.parametrize('server_type', ('FTP', 'HTTP')) @@ -213,4 +213,4 @@ def test_use_netrc(cli, datafiles, server_type, tmpdir): result.assert_success() checkout_file = os.path.join(checkoutdir, 'file') - assert(os.path.exists(checkout_file)) + assert os.path.exists(checkout_file) diff --git a/tests/sources/tar.py b/tests/sources/tar.py index 8d7d37c56..ed99036b2 100644 --- a/tests/sources/tar.py +++ b/tests/sources/tar.py @@ -147,7 +147,7 @@ def test_stage_default_basedir(cli, tmpdir, datafiles, srcdir): original_dir = os.path.join(str(datafiles), "content", "a") original_contents = list_dir_contents(original_dir) checkout_contents = list_dir_contents(checkoutdir) - assert(checkout_contents == original_contents) + assert checkout_contents == original_contents # Test that a staged checkout matches what was tarred up, with an empty base-dir @@ -176,7 +176,7 @@ def test_stage_no_basedir(cli, tmpdir, datafiles, srcdir): original_dir = os.path.join(str(datafiles), "content") original_contents = list_dir_contents(original_dir) checkout_contents = list_dir_contents(checkoutdir) - assert(checkout_contents == original_contents) + assert checkout_contents == original_contents # Test that a staged checkout matches what was tarred up, with an explicit basedir @@ -205,7 +205,7 @@ def test_stage_explicit_basedir(cli, tmpdir, datafiles, srcdir): original_dir = os.path.join(str(datafiles), "content", "a") original_contents = list_dir_contents(original_dir) checkout_contents = list_dir_contents(checkoutdir) - assert(checkout_contents == original_contents) + assert checkout_contents == original_contents # Test that we succeed to extract tarballs with hardlinks when stripping the @@ -241,7 +241,7 @@ def test_stage_contains_links(cli, tmpdir, datafiles): original_dir = os.path.join(str(datafiles), "content", "base-directory") original_contents = list_dir_contents(original_dir) checkout_contents = list_dir_contents(checkoutdir) - assert(checkout_contents == original_contents) + assert checkout_contents == original_contents @pytest.mark.skipif(not HAVE_LZIP, reason='lzip is not available') @@ -270,7 +270,7 @@ def test_stage_default_basedir_lzip(cli, tmpdir, datafiles, srcdir): original_dir = os.path.join(str(datafiles), "content", "a") original_contents = list_dir_contents(original_dir) checkout_contents = list_dir_contents(checkoutdir) - assert(checkout_contents == original_contents) + assert checkout_contents == original_contents # Test that a tarball that contains a read only dir works @@ -355,7 +355,7 @@ def test_use_netrc(cli, datafiles, server_type, tmpdir): original_dir = os.path.join(str(datafiles), 'content', 'a') original_contents = list_dir_contents(original_dir) checkout_contents = list_dir_contents(checkoutdir) - assert(checkout_contents == original_contents) + assert checkout_contents == original_contents @pytest.mark.parametrize('server_type', ('FTP', 'HTTP')) diff --git a/tests/sources/zip.py b/tests/sources/zip.py index c15453242..273c0c3a4 100644 --- a/tests/sources/zip.py +++ b/tests/sources/zip.py @@ -131,7 +131,7 @@ def test_stage_default_basedir(cli, tmpdir, datafiles): original_dir = os.path.join(str(datafiles), "content", "a") original_contents = list_dir_contents(original_dir) checkout_contents = list_dir_contents(checkoutdir) - assert(checkout_contents == original_contents) + assert checkout_contents == original_contents # Test that a staged checkout matches what was tarred up, with an empty base-dir @@ -159,7 +159,7 @@ def test_stage_no_basedir(cli, tmpdir, datafiles): original_dir = os.path.join(str(datafiles), "content") original_contents = list_dir_contents(original_dir) checkout_contents = list_dir_contents(checkoutdir) - assert(checkout_contents == original_contents) + assert checkout_contents == original_contents # Test that a staged checkout matches what was tarred up, with an explicit basedir @@ -187,7 +187,7 @@ def test_stage_explicit_basedir(cli, tmpdir, datafiles): original_dir = os.path.join(str(datafiles), "content", "a") original_contents = list_dir_contents(original_dir) checkout_contents = list_dir_contents(checkoutdir) - assert(checkout_contents == original_contents) + assert checkout_contents == original_contents @pytest.mark.parametrize('server_type', ('FTP', 'HTTP')) @@ -228,4 +228,4 @@ def test_use_netrc(cli, datafiles, server_type, tmpdir): original_dir = os.path.join(str(datafiles), 'content', 'a') original_contents = list_dir_contents(original_dir) checkout_contents = list_dir_contents(checkoutdir) - assert(checkout_contents == original_contents) + assert checkout_contents == original_contents diff --git a/tests/testutils/http_server.py b/tests/testutils/http_server.py index f18290c88..049769e72 100644 --- a/tests/testutils/http_server.py +++ b/tests/testutils/http_server.py @@ -69,7 +69,7 @@ class RequestHandler(SimpleHTTPRequestHandler): path = path.split('?', 1)[0] path = path.split('#', 1)[0] path = posixpath.normpath(path) - assert(posixpath.isabs(path)) + assert posixpath.isabs(path) path = posixpath.relpath(path, '/') return os.path.join(self.get_root_dir(), path) diff --git a/tests/testutils/setuptools.py b/tests/testutils/setuptools.py index 39f4314f2..cb61e1976 100644 --- a/tests/testutils/setuptools.py +++ b/tests/testutils/setuptools.py @@ -33,9 +33,9 @@ def entry_fixture(monkeypatch): dist, package = lookup_string.split(':') def mock_entry(pdist, pentry_point, ppackage): - assert(pdist == dist) - assert(pentry_point == entry_point) - assert(ppackage == package) + assert pdist == dist + assert pentry_point == entry_point + assert ppackage == package return MockEntry(datafiles, package) monkeypatch.setattr(pkg_resources, 'get_entry_info', mock_entry) |