-
Notifications
You must be signed in to change notification settings - Fork 36
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
Conversation
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"] |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
96c3736
to
410421f
Compare
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 runpython -m pytest -s -vv
(if you have postgres installed locally)