diff --git a/test/conftest.py b/test/conftest.py index 7a57690..0787371 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -93,7 +93,13 @@ def tst_distro_family(runner): @pytest.fixture(scope="session") def tst_sys(): """Test session's uname value""" - return platform.system() + system = platform.system() + if system == "Linux": + # Additional check for WSL + with open("/proc/version", "r", encoding="utf-8") as f: + if "icrosoft" in f.read(): + return "WSL" + return system @pytest.fixture(scope="session") diff --git a/test/test_unit_set_os.py b/test/test_unit_set_os.py index ac61de2..d519c18 100644 --- a/test/test_unit_set_os.py +++ b/test/test_unit_set_os.py @@ -24,8 +24,7 @@ def test_set_operating_system(runner, paths, tst_sys, proc_value, expected_os): # Normally /proc/version (set in PROC_VERSION) is inspected to identify # WSL. During testing, we will override that value. proc_version = paths.root.join("proc_version") - if proc_value != "missing": - proc_version.write(proc_value) + proc_version.write(proc_value) script = f""" YADM_TEST=1 source {paths.pgm} PROC_VERSION={proc_version} @@ -36,5 +35,8 @@ def test_set_operating_system(runner, paths, tst_sys, proc_value, expected_os): assert run.success assert run.err == "" if expected_os == "uname": - expected_os = tst_sys + if tst_sys != "WSL": + expected_os = tst_sys + else: + expected_os = "Linux" assert run.out.rstrip() == expected_os