Skip to content

Commit

Permalink
Install servicelayer before running tests
Browse files Browse the repository at this point in the history
Tests in `test_extensions.py` rely on `servicelayer` being installed as they ultimately read information from the egg info that is created during installation.

This is basically equivalent to the previous setup which executed `pip install -e .` outside of the container. As the entire directory is mounted into the container, the egg info subsequently was also available inside of the container. While that worked I found the fact that installing something outside of the container could make the tests fail or pass quite confusing. This should be a little more explicit.
  • Loading branch information
tillprochaska committed Feb 2, 2024
1 parent 5a70853 commit e3351e6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
- name: Run the linter
run: make lint
- name: Run the tests
run: |
make test
# Some tests rely on the package being installed
run: docker compose run --rm shell bash -c "make install && make tests"
- name: Build a distribution
run: |
python setup.py sdist bdist_wheel
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dev:
python3 -m pip install -q -r requirements-dev.txt

test:
docker-compose run --rm shell pytest --cov=servicelayer
pytest --cov=servicelayer

lint:
ruff check .
Expand Down
2 changes: 2 additions & 0 deletions tests/test_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

class ExtensionTest(TestCase):
def test_extensions(self):
# This relies on the servicelayer package being installed as `get_extensions`
# ultimately reads entrypoints from the egg info
exts = get_extensions("servicelayer.test")
assert len(exts), exts
assert get_extensions in exts, exts

0 comments on commit e3351e6

Please sign in to comment.