My pytests work when I run them locally, but not in github actions. I think this might be due to the module path format but I really am stumped as to why.
Here is my config:
name: Python package
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install pytest
pip install .
- name: Verify installation
run: |
source venv/bin/activate
pip list
- name: Debug Package Installation
run: |
source venv/bin/activate
echo "Installed package files:"
find venv/lib/python3.9/site-packages/ml_save_memory_flow -type f || true
- name: Print Python Path
run: |
source venv/bin/activate
echo "PYTHONPATH:"
echo $PYTHONPATH
- name: Run tests
run: |
source venv/bin/activate
pytest ml_save_memory_flow/tests --verbose
I get the error:
------------------------------- Captured stdout --------------------------------
Resource gazetteer exists in package ml_save_memory_flow.ner_re.resources: False
=========================== short test summary info ============================
ERROR ml_save_memory_flow/tests/E2E_test.py - FileNotFoundError: 'gazetteer' resource not found in 'ml_save_memory_flow.ner_re.resources'
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 5.86s ===============================
Error: Process completed with exit code 2.
However it is installed in site-packages and all paths seem correct.
venv/lib/python3.9/site-packages/ml_save_memory_flow/ner_re/resources/gazetteer
setup.py also incudes:
package_data={
'ml_save_memory_flow.ner_re.resources': ['*'],
}
Is there anything else I can debug to find out why the packages are not being found?