Re: [osinfo-db-tools PATCH v2] test_osinfo_db_path: Unset OSINFO_*_DIR envvars

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>

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@xxxxxxxxxx>

> ---
>  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

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux