Skip to content
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

Run tests against fondant package with tox #283

Merged
merged 7 commits into from
Jul 10, 2023
Merged

Run tests against fondant package with tox #283

merged 7 commits into from
Jul 10, 2023

Conversation

RobbeSneyders
Copy link
Member

@RobbeSneyders RobbeSneyders commented Jul 10, 2023

This PR contains a couple of changes to make sure we test against the built fondant package instead of against the raw source code. This is best practice, but I also need this for the next PR I'll open as there the tests will fail if they are not run against the built package.

Each of these changes is contained in a separate PR.

To run tests locally, you can just run one of the following commands:

  • tox this will automatically skip test environments that require other python versions
  • tox -e py310 to select a specific environment to run, skipping other environments like pre-commit

Copy link
Contributor

@PhilippeMoussalli PhilippeMoussalli left a comment

Choose a reason for hiding this comment

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

Thanks Robbe!

Left a few questions

tox.ini Outdated

[testenv:check-licenses]
deps=
liccheck==0.7.3
Copy link
Contributor

Choose a reason for hiding this comment

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

can we have soft dependency versions here like we had in pyproject.toml? (same for pytest, and pytest-cov)

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. Updated.

[tox]
isolated_build = True
envlist =
pre-commit
Copy link
Contributor

Choose a reason for hiding this comment

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

do these dependencies only get built when running tox then? does it automatically invoke pip install on them since we no longer have them in the pyproject.toml

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, installs in this file are only installed by tox when executing the related environment. If a dependency is only needed for a single environment type, I moved them from pyproject.toml to here, and I added tox to pyproject.toml.

Copy link
Contributor

Choose a reason for hiding this comment

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

alright thanks for the clarification

@RobbeSneyders RobbeSneyders merged commit 879da0b into main Jul 10, 2023
@RobbeSneyders RobbeSneyders deleted the feature/tox branch July 10, 2023 14:49
Hakimovich99 pushed a commit that referenced this pull request Oct 16, 2023
This PR contains a couple of changes to make sure we test against the
built fondant package instead of against the raw source code. This is
best practice, but I also need this for the next PR I'll open as there
the tests will fail if they are not run against the built package.

- Introduce tox, which makes it easy to build the fondant package before
running our tests
- Move the fondant source code into a `src` folder, so we don't
accidentally test against the source code. See these articles for more
info (https://hynek.me/articles/testing-packaging/,
https://blog.ganssle.io/articles/2019/08/test-as-installed.html)
- Ruff now recognizes `fondant` as a third party package in our
components and tests, and has reorganized the imports accordingly

Each of these changes is contained in a separate PR.

To run tests locally, you can just run one of the following commands:
- `tox` this will automatically skip test environments that require
other python versions
- `tox -e py310` to select a specific environment to run, skipping other
environments like pre-commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants