From dc692a2afd553fdf0d277166ceacca2c6036f6c2ae81ea7d591c69b32f00f595 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Mon, 24 Jan 2022 09:39:50 +0000 Subject: [PATCH] - My ad-hoc patch failed_test_use_command.patch replaced by the upstream mark-tests-path.patch (from gh#pdm-project/pdm#commit/23f1cf62a302 and gh#pdm-project/pdm#865). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pdm?expand=0&rev=3 --- failed_test_use_command.patch | 17 ----------- mark-tests-path.patch | 56 +++++++++++++++++++++++++++++++++++ python-pdm.changes | 7 +++++ python-pdm.spec | 15 ++++------ 4 files changed, 69 insertions(+), 26 deletions(-) delete mode 100644 failed_test_use_command.patch create mode 100644 mark-tests-path.patch diff --git a/failed_test_use_command.patch b/failed_test_use_command.patch deleted file mode 100644 index 132f6df..0000000 --- a/failed_test_use_command.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- - tests/cli/test_use.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/tests/cli/test_use.py -+++ b/tests/cli/test_use.py -@@ -11,8 +11,8 @@ from pdm.models.caches import JSONFileCa - - - def test_use_command(project, invoke): -- python_path = Path(shutil.which("python")).as_posix() -- result = invoke(["use", "-f", "python"], obj=project) -+ python_path = Path(shutil.which("python3")).as_posix() -+ result = invoke(["use", "-f", "python3"], obj=project) - assert result.exit_code == 0 - config_content = project.root.joinpath(".pdm.toml").read_text() - assert python_path in config_content diff --git a/mark-tests-path.patch b/mark-tests-path.patch new file mode 100644 index 0000000..dbe018c --- /dev/null +++ b/mark-tests-path.patch @@ -0,0 +1,56 @@ +From 23f1cf62a302633524496b0ba43239aae1e90c8e Mon Sep 17 00:00:00 2001 +From: Frost Ming +Date: Mon, 24 Jan 2022 11:17:46 +0800 +Subject: [PATCH] Mark tests that compare paths as unstable Related to #865 + +--- + pyproject.toml | 1 + + tests/cli/test_use.py | 5 +++-- + tests/test_project.py | 1 + + tests/test_utils.py | 1 + + 4 files changed, 6 insertions(+), 2 deletions(-) + +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -129,6 +129,7 @@ filterwarnings = [ "ignore::DeprecationW + markers = [ + "network: Tests that require network", + "integration: Run with all Python versions", ++ "path: Tests that compare with the system paths", + ] + addopts = "-ra" + +--- a/tests/cli/test_use.py ++++ b/tests/cli/test_use.py +@@ -11,8 +11,9 @@ from pdm.models.caches import JSONFileCa + + + def test_use_command(project, invoke): +- python_path = Path(shutil.which("python")).as_posix() +- result = invoke(["use", "-f", "python"], obj=project) ++ python = "python" if os.name == "nt" else "python3" ++ python_path = Path(shutil.which(python)).as_posix() ++ result = invoke(["use", "-f", python], obj=project) + assert result.exit_code == 0 + config_content = project.root.joinpath(".pdm.toml").read_text() + assert python_path in config_content +--- a/tests/test_project.py ++++ b/tests/test_project.py +@@ -206,6 +206,7 @@ def test_global_python_path_config(proje + assert "python.path" not in p.project_config + + ++@pytest.mark.path + def test_set_non_exist_python_path(project_no_init): + project_no_init.project_config["python.path"] = "non-exist-python" + project_no_init._python = None +--- a/tests/test_utils.py ++++ b/tests/test_utils.py +@@ -50,6 +50,7 @@ def test_expend_env_vars_in_auth(given, + assert utils.expand_env_vars_in_auth(given) == expected + + ++@pytest.mark.path + def test_find_python_in_path(tmp_path): + + assert ( diff --git a/python-pdm.changes b/python-pdm.changes index 2e3ea00..d3631af 100644 --- a/python-pdm.changes +++ b/python-pdm.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Jan 24 09:37:39 UTC 2022 - Matej Cepl + +- My ad-hoc patch failed_test_use_command.patch replaced by the + upstream mark-tests-path.patch (from + gh#pdm-project/pdm#commit/23f1cf62a302 and gh#pdm-project/pdm#865). + ------------------------------------------------------------------- Sun Jan 23 20:56:10 UTC 2022 - Matej Cepl diff --git a/python-pdm.spec b/python-pdm.spec index 2b7e7a7..6ebbb54 100644 --- a/python-pdm.spec +++ b/python-pdm.spec @@ -33,9 +33,10 @@ Patch0: mark-network-tests.patch # PATCH-FIX-OPENSUSE sys-exec-failures.patch mcepl@suse.com # sys.executable is too long with python3.10 Patch1: sys-exec-failures.patch -# PATCH-{FIX|FEATURE}-{OPENSUSE|SLE|UPSTREAM} name-of-file.patch bsc#[0-9]+ mcepl@suse.com -# this patch makes things totally awesome -Patch2: failed_test_use_command.patch +# PATCH-FIX-UPSTREAM mark-tests-path.patch gh#pdm-project/pdm#865 mcepl@suse.com +# mark tests which depend on exact paths of executables +# https://github.com/pdm-project/pdm/commit/23f1cf62a302 +Patch2: mark-tests-path.patch BuildRequires: %{python_module blinker} BuildRequires: %{python_module click >= 7} BuildRequires: %{python_module importlib-metadata if %python-base < 3.8} @@ -110,12 +111,8 @@ doesn't need to create a virtualenv at all! %python_uninstall_alternative pdm %check -# the test_use_python_by_version is gh#pdm-project/pdm#865 -# large group is gh#pdm-project/pdm#864 -# test_find_python_in_path and test_show_self_package are still -# remainders in gh#pdm-project/pdm#864 - -%pytest -k 'not (network or test_use_python_by_version or test_find_python_in_path or test_show_self_package)' +# the test_show_self_package is gh#pdm-project/pdm#865 +%pytest -k 'not (network or path or test_show_self_package)' %files %{python_files} %doc README.md