SHA256
1
0
forked from pool/python-pdm

- 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
This commit is contained in:
Matej Cepl 2022-01-24 09:39:50 +00:00 committed by Git OBS Bridge
parent 15cc59fe47
commit dc692a2afd
4 changed files with 69 additions and 26 deletions

View File

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

56
mark-tests-path.patch Normal file
View File

@ -0,0 +1,56 @@
From 23f1cf62a302633524496b0ba43239aae1e90c8e Mon Sep 17 00:00:00 2001
From: Frost Ming <mianghong@gmail.com>
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 (

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Jan 24 09:37:39 UTC 2022 - Matej Cepl <mcepl@suse.com>
- 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 <mcepl@suse.com>

View File

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