I'm developing a Python package called gtfs_railways, and my local setup is working perfectly — but in CI, path resolution breaks and makes my tests fail. Note that, for legacy reasons, I am using Python 3.8. Here's the structure of my project: gtfs_railways/ ├── gtfs_railways/ │ ├── init.py │ ├── utils/ │ ├── data/ │ ├── functions/ │ ├── tests/ ├── setup.py ├── README.md Locally I'm using pytest 8.3.5: platform darwin -- Python 3.8.20, pytest-8.3.5, pluggy-1.5.0 rootdir: /Users/marco/Work-MBP/gtfs_railways plugins: cov-5.0.0, anyio-4.5.2 and everything works fine. On macOS GitHub Actions runners (macos-latest), even with actions/setup-python@v5 and specifying Python 3.8.20, I get: platform darwin -- Python 3.8.10, pytest-8.3.5, pluggy-1.5.0 rootdir: /Users/runner/work/gtfs_railways/gtfs_railways As you can see, there is an extra gtfs_railways/ nesting in the path that breaks everything, especially any relative imports or dynamic file loading logic that relies on the rootdir. So far I've tried several workarounds to oblige pytest in the right rootdir, but all seem to be failing: Checkout fix - uses: actions/checkout@v4 with: path: . Explicit working directory - name: Run tests run: pytest -v -s working-directory: ${{ github.workspace }} Set PYTHONPATH - name: Set PYTHONPATH run: echo "PYTHONPATH=${{ github.workspace }}" >> $GITHUB_ENV Tried pytest --rootdir=. I'm using only basic sh steps. No tox, no poetry, no custom runners — just plain pip and pytest. Any thoughts? I noticed that ${{ github.workspace }} = /Users/runner/work/gtfs_railways/gtfs_railways perhaps I could simply modify this line? What else can I try to make pytest behave consistently across environments? Continue reading...