Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests to run from anywhere #211

Merged
merged 7 commits into from
Jan 29, 2025

Conversation

samer-hamood
Copy link
Contributor

@samer-hamood samer-hamood commented Jan 23, 2025

Fixed tests failing (to find test files) when running from the IDE or the terminal when not in the project root directory.

This was achieved by adding a reference to the project root directory to the path of referenced files:

project_root = Path(__file__).parent.parent.parent.absolute()

Tested with Python 3.13.

From the IDE

Tested with PyCharm 2024.3.1.1 (Community Edition).

From Command Line

Running poetry run pytest from project root directory passes but fails from other directories:

E.g 1: from PyFunctional/functional

PyFunctional/functional:>   poetry run pytest
 ...
 E       FileNotFoundError: [Errno 2] No such file or directory: 'functional/test/data/test.jsonl.xz'
 ...

E.g 2: from PyFunctional/functional/test

PyFunctional/functional/test:>   poetry run pytest
...
FAILED test_streams.py::TestParallelStreams::test_to_csv_compressed - FileNotFoundError: [Errno 2] No such file or directory: 'functional/test/data/tmp/output.txt'
...

@samer-hamood samer-hamood marked this pull request as draft January 23, 2025 19:50
@samer-hamood samer-hamood marked this pull request as ready for review January 23, 2025 20:28
@samer-hamood
Copy link
Contributor Author

The build (3.8) needs to be bypassed on all PRs 😭

@EntilZha EntilZha merged commit 9ab8a51 into EntilZha:master Jan 29, 2025
5 checks passed
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.

2 participants