aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests/tools
diff options
authorJaime Resano <gemailpersonal02@gmail.com>2025-04-27 23:41:40 +0200
committerJaime Resano <gemailpersonal02@gmail.com>2025-05-09 19:38:50 +0200
commit9ad97270b5ce1b0ef8103041e7309744825f1810 (patch)
tree8a92aec4685a97f171600e01fe638e8aaf3189f8 /sources/pyside6/tests/tools
parentf81fb9ee887d088e8988d743bb7cac4f781fff82 (diff)
Fix pyside6-project relative paths handling and pyproject.toml migrationHEADdev
This patch fixes two existing bugs in the pyside6-project tool: 1. Relative file paths outside the project folder in the .pyproject file e.g. files = ["../main.py"] are not handled correctly. A ValueError is raised due to the usage of Path.relative_to Fixed using a new function: robust_relative_to_posix() Updated the example_project test to contain this edge case (Suggestion: use this as a replacement for the rel_path() function located in tools/example_gallery/main.py) 2. The migration of a .pyproject to a pyproject.toml file with existing content is not done properly due to removing the tomlkit implementation. Fixed by appending the [tool.pyside6-project] section (and the [project] section too) at the end of the file (I don't know how the tests were passing before ??) Change-Id: Ie061c9fa172c429c8b45381bbec35ad30d01f4ee Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside6/tests/tools')
-rw-r--r--sources/pyside6/tests/tools/pyside6-project/example_project/subproject/pyproject.toml2
-rw-r--r--sources/pyside6/tests/tools/pyside6-project/example_project/subproject/subproject.pyproject2
-rw-r--r--sources/pyside6/tests/tools/pyside6-project/existing_pyproject_toml/expected_pyproject.toml5
-rw-r--r--sources/pyside6/tests/tools/pyside6-project/test_pyside6_project.py2
4 files changed, 7 insertions, 4 deletions
diff --git a/sources/pyside6/tests/tools/pyside6-project/example_project/subproject/pyproject.toml b/sources/pyside6/tests/tools/pyside6-project/example_project/subproject/pyproject.toml
index 1ceb0ac0b..b6f16e698 100644
--- a/sources/pyside6/tests/tools/pyside6-project/example_project/subproject/pyproject.toml
+++ b/sources/pyside6/tests/tools/pyside6-project/example_project/subproject/pyproject.toml
@@ -2,4 +2,4 @@
name = "subproject"
[tool.pyside6-project]
-files = ["subproject_button.py"]
+files = ["subproject_button.py", "../main.py"]
diff --git a/sources/pyside6/tests/tools/pyside6-project/example_project/subproject/subproject.pyproject b/sources/pyside6/tests/tools/pyside6-project/example_project/subproject/subproject.pyproject
index abfa1f461..688f07c33 100644
--- a/sources/pyside6/tests/tools/pyside6-project/example_project/subproject/subproject.pyproject
+++ b/sources/pyside6/tests/tools/pyside6-project/example_project/subproject/subproject.pyproject
@@ -1,3 +1,3 @@
{
- "files": ["subproject_button.py"]
+ "files": ["subproject_button.py", "../main.py"]
}
diff --git a/sources/pyside6/tests/tools/pyside6-project/existing_pyproject_toml/expected_pyproject.toml b/sources/pyside6/tests/tools/pyside6-project/existing_pyproject_toml/expected_pyproject.toml
index be8aa949f..c0adb0c76 100644
--- a/sources/pyside6/tests/tools/pyside6-project/existing_pyproject_toml/expected_pyproject.toml
+++ b/sources/pyside6/tests/tools/pyside6-project/existing_pyproject_toml/expected_pyproject.toml
@@ -15,8 +15,9 @@ target-version = ["py38"]
# Another comment
-[tool.pyside6-project]
-files = ["main.py", "zzz.py"]
[build-system]
requires = ["setuptools >=42"]
build-backend = "setuptools.build_meta"
+
+[tool.pyside6-project]
+files = ["main.py", "zzz.py"]
diff --git a/sources/pyside6/tests/tools/pyside6-project/test_pyside6_project.py b/sources/pyside6/tests/tools/pyside6-project/test_pyside6_project.py
index d66395251..cbacc4e48 100644
--- a/sources/pyside6/tests/tools/pyside6-project/test_pyside6_project.py
+++ b/sources/pyside6/tests/tools/pyside6-project/test_pyside6_project.py
@@ -1,5 +1,7 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+from __future__ import annotations
+
import contextlib
import difflib
import importlib