[Libosinfo] [osinfo-db-tools PATCH v2] test_osinfo_db_path: Unset OSINFO_*_DIR envvars
Cole Robinson
crobinso at redhat.com
Tue Apr 30 18:55:58 UTC 2019
On 4/30/19 7:13 AM, Fabiano Fidêncio wrote:
> Let's just unset the OSINFO_{SYSTEM,DATA,USER}_DIR environment variables
> in our tests, in case those were externally set for some reason.
>
> Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
At first I thought this should be done globally but I see it follows the
pattern of the other tests which override these env variables as needed.
So this makes sense to me
Reviewed-by: Cole Robinson <crobinso at redhat.com>
> ---
> tests/test_osinfo_db_path.py | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/tests/test_osinfo_db_path.py b/tests/test_osinfo_db_path.py
> index bc3c549..d813c34 100755
> --- a/tests/test_osinfo_db_path.py
> +++ b/tests/test_osinfo_db_path.py
> @@ -18,6 +18,8 @@ def test_osinfo_db_path_system():
> """
> Test osinfo-db-path --system
> """
> + if "OSINFO_SYSTEM_DIR" in os.environ:
> + del os.environ["OSINFO_SYSTEM_DIR"]
> cmd = [util.Tools.db_path, util.ToolsArgs.SYSTEM]
> output = util.get_output(cmd)
> expected_output = os.path.join(DATADIR, "osinfo\n")
> @@ -28,6 +30,8 @@ def test_osinfo_db_path_local():
> """
> Test osinfo-db-path --local
> """
> + if "OSINFO_DATA_DIR" in os.environ:
> + del os.environ["OSINFO_DATA_DIR"]
> cmd = [util.Tools.db_path, util.ToolsArgs.LOCAL]
> output = util.get_output(cmd)
> expected_output = os.path.join(SYSCONFDIR, "osinfo\n")
> @@ -38,6 +42,8 @@ def test_osinfo_db_path_user():
> """
> Test osinfo-db-path --user
> """
> + if "OSINFO_USER_DIR" in os.environ:
> + del os.environ["OSINFO_USER_DIR"]
> cmd = [util.Tools.db_path, util.ToolsArgs.USER]
> output = util.get_output(cmd)
> expected_output = os.path.join(os.environ["HOME"], ".config",
> @@ -59,6 +65,8 @@ def test_osinfo_db_path_root():
> """
> Test osinfo-db-path --root FOOBAR_DIR --system
> """
> + if "OSINFO_SYSTEM_DIR" in os.environ:
> + del os.environ["OSINFO_SYSTEM_DIR"]
> cmd = [util.Tools.db_path, util.ToolsArgs.ROOT, FOOBAR_DIR,
> util.ToolsArgs.SYSTEM]
> output = util.get_output(cmd)
>
- Cole
More information about the Libosinfo
mailing list