Skip to content

refactor tests suite in order to run it locally outside docker #102

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

Merged
merged 7 commits into from
Apr 22, 2024

Conversation

vincentsarago
Copy link
Member

@vincentsarago vincentsarago commented Apr 22, 2024

This PR propose a refactor of the test suite, moving from local database to pytest fixture.

This is to ensure we don't touch the local postgres which may run on the user's computer.

This PR also aims to speed up the CI (avoiding building and user docker image)

FYI:

make test is still working for people who want to run tests in Docker but now you can also simply run python -m pytest -s -vv (if you have postgres installed locally)

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add python 3.12

--log-driver none
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need this external service when using postgres pytest fixture

@@ -16,6 +18,6 @@ WORKDIR /app

COPY . /app

RUN pip install -e .[dev,server]
RUN python -m pip install -e .[server]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This image is now used only for the server part. we'll use another image for testing (make test)

postgres_host_writer=database.host,
postgres_port=database.port,
postgres_dbname=database.dbname,
testing=True,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testing=True could be removed because we are setting the dbname in the settings

version = migrator.run_migration()
assert version

yield jan
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the database fixture

@@ -3,18 +3,18 @@ repos:
rev: 5.12.0
hooks:
- id: isort
language_version: python3.8
language_version: python
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change enables to run pre-commit on other python version

@vincentsarago vincentsarago force-pushed the feature/refactor-tests-suite branch from 96c3736 to 410421f Compare April 22, 2024 15:33
@vincentsarago vincentsarago merged commit 07350f5 into main Apr 22, 2024
@vincentsarago vincentsarago deleted the feature/refactor-tests-suite branch April 22, 2024 20:14
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