Skip to content

Fix python tests relative paths#105

Merged
kunitoki merged 1 commit into
mainfrom
dev/fix_python_tests_relative_modules
May 28, 2026
Merged

Fix python tests relative paths#105
kunitoki merged 1 commit into
mainfrom
dev/fix_python_tests_relative_modules

Conversation

@kunitoki
Copy link
Copy Markdown
Owner

This pull request updates the import system throughout the python/tests directory to simplify and standardize how test modules import shared utilities and the common module. The main change is to ensure that test files can use direct imports instead of relative imports by adding the test folder to sys.path at runtime. This improves compatibility and avoids import errors when running tests.

Key changes:

Import system modernization:

  • Added logic to __init__.py and conftest.py to insert the test folder into sys.path if not already present. This allows for direct imports of modules like common and utilities from anywhere in the test suite. [1] [2]

Refactoring imports in test modules:

  • Replaced all relative imports (e.g., from ..utilities import ...) with direct imports (e.g., from utilities import ...) in test files in test_yup_core, test_yup_events, and test_yup_graphics subdirectories. This includes updates in files such as test_File.py, test_FileFilter.py, test_FileOutputStream.py, test_JSON.py, test_TemporaryFile.py, test_XmlElement.py, and test_ZipFile.py. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]

These changes make the test suite more robust and easier to maintain by eliminating fragile relative imports and ensuring consistent module resolution.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.87%. Comparing base (b7eee0c) to head (bc5c413).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #105      +/-   ##
==========================================
+ Coverage   74.85%   74.87%   +0.02%     
==========================================
  Files         590      590              
  Lines       59209    59209              
==========================================
+ Hits        44319    44334      +15     
+ Misses      14890    14875      -15     

see 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b7eee0c...bc5c413. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kunitoki kunitoki merged commit a378f4a into main May 28, 2026
40 checks passed
@kunitoki kunitoki deleted the dev/fix_python_tests_relative_modules branch May 28, 2026 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant