When I run pytest
locally, everything passes. I just added CircleCI to see what I can do with it, and pushed it to GitHub, but I keep getting a ModuleNotFoundError even though the module in question is a local file.
This is the way my files are set up:
folder
thing
blah.py
tests/thing
test_blah.py
In tests/thing, I run:
sys.path.append("/Users/user/folder/")
from thing/blah import Class
And then I get this error:
tests/thing/test_blah.py:8: in <module>
from thing.blah import Class
E ModuleNotFoundError: No module named 'thing'
I’m not entirely sure what’s going on. Can someone help?
I am using the basic config
file given when you start a CircleCI project.
version: 2.1
orbs:
python: circleci/python@2.1.1
jobs:
build-and-test:
docker:
- image: cimg/python:3.11.2
steps:
- checkout
- python/install-packages:
pkg-manager: pip
- run:
name: Run tests
command: pytest
workflows:
test_app:
jobs:
- build-and-test