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

#37 Added the pytest-backend project #38

Merged
merged 14 commits into from
Aug 7, 2024
Merged

Conversation

ahsimb
Copy link
Contributor

@ahsimb ahsimb commented Aug 2, 2024

closes #37

@ahsimb ahsimb added the feature Product feature label Aug 2, 2024
@ahsimb ahsimb requested a review from ckunki August 2, 2024 13:01
@ahsimb ahsimb self-assigned this Aug 2, 2024
Nicoretti
Nicoretti previously approved these changes Aug 5, 2024
Copy link
Member

@Nicoretti Nicoretti left a comment

Choose a reason for hiding this comment

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

Hi @ahsimb,

I really like the plugin, just a few small things you might want to consider.

  1. Adding an "all" target/option for executing against all backend types
  2. In combination with 1. changing the default to onprem

My reasoning/thinking behind this is the following:

  • Usually the developers want to be quick to run the local tests
  • Local testing usally is done with DockerDB (onprem) -> typically faster
  • The CI test run will be "statically" configured, adding a flag or option to the config, is a one time effort
  • Running only onprem while testing locally needs to be specified on each local test run (tedious)

best
Nico

backend_options = metafunc.config.getoption("--backend")
if not backend_options:
backend_options = [_BACKEND_ONPREM, _BACKEND_SAAS]
metafunc.parametrize("backend", backend_options)
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

indirect is a way to inject parameters into a fixture from a test. At least that is how I used it. Here I am setting the parameters from a cli.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Re: default targets. The motivation for including both backends by default was two-fold.

  1. It makes tests super easy.
  2. One can argue that the priority is to make sure all tests run on all backends, rather than saving a few seconds of typing. If you need to override the default to include all backends there is a good chance it will be forgotten and the tests on SaaS will never be activated.

Copy link
Member

Choose a reason for hiding this comment

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

indirect is a way to inject parameters into a fixture from a test. At least that is how I used it. Here I am setting the parameters from a cli.

AFIK in case of the metafunc, it is more about when it is executed if I understand it correctly, TL;DR: collection vs setup - Phase.

Nicoretti
Nicoretti previously approved these changes Aug 5, 2024
justfile Outdated Show resolved Hide resolved
Nicoretti
Nicoretti previously approved these changes Aug 5, 2024
justfile Show resolved Hide resolved
pytest-backend/README.md Outdated Show resolved Hide resolved
pytest-backend/exasol/pytest_backend/__init__.py Outdated Show resolved Hide resolved
pytest-backend/exasol/pytest_backend/__init__.py Outdated Show resolved Hide resolved
pytest-backend/poetry.lock Outdated Show resolved Hide resolved
Comment on lines 13 to 14
pytest-exasol-itde = { path = "../pytest-itde" }
pytest-exasol-saas = { path = "../pytest-saas" }
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these references to pypi packages?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are references to the projects in the same repo.

Copy link
Contributor

Choose a reason for hiding this comment

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

I propose to replace these by references to pypi packages.

Copy link
Contributor Author

@ahsimb ahsimb Aug 6, 2024

Choose a reason for hiding this comment

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

That will complicate the process of making changes to the plugins. One would need to change the pytest-itde or pytest-saas, then make a release, then update the pytest-backend and make another release. Is there a particular issue with referencing other projects in the same repo as it is now?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am thinking of users using the plugins.
The users will use a pypi reference to backend, I assume.
pypi will not be able to resolve the transitive references with path = "...".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will it not? I will do some experiments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I built a wheel for the pytest-exasol-backend and installed it in a new venv. All 3 plugins are there, so it seems to work.

pytest-backend/pyproject.toml Show resolved Hide resolved
pytest-backend/pyproject.toml Show resolved Hide resolved
Comment on lines 13 to 14
pytest-exasol-itde = { path = "../pytest-itde" }
pytest-exasol-saas = { path = "../pytest-saas" }
Copy link
Contributor

Choose a reason for hiding this comment

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

I propose to replace these by references to pypi packages.

pytest-backend/poetry.lock Outdated Show resolved Hide resolved
pytest-backend/poetry.lock Outdated Show resolved Hide resolved
pytest-backend/exasol/pytest_backend/__init__.py Outdated Show resolved Hide resolved
pytest-backend/README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@ckunki ckunki left a comment

Choose a reason for hiding this comment

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

Please consider additionally updating justfile and global README.md.

PROJECTS := "pytest-saas pytest-itde"

@ahsimb
Copy link
Contributor Author

ahsimb commented Aug 6, 2024

I did update the justfile, otherwise the tests wouldn't be running. Now updated the global README.md, but not in great detail, as the plugin structure will likely undergo a significant change.

ckunki

This comment was marked as resolved.

ckunki
ckunki previously approved these changes Aug 6, 2024
ckunki
ckunki previously approved these changes Aug 7, 2024
@ahsimb ahsimb merged commit 3071754 into main Aug 7, 2024
1 check passed
@ahsimb ahsimb deleted the feature/37-backend-project branch August 7, 2024 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Product feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a backend plugins project
3 participants