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

Make the project installable as a pytest plugin #1

Merged
merged 9 commits into from May 17, 2022

Conversation

ocaballeror
Copy link
Contributor

By submitting a PR to this repository, you agree to the terms within the Auth0 Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.

Description

Describe the purpose of this PR along with any background information and the impacts of the proposed change. For the benefit of the community, please do not assume prior context.

Main purpose is to make this project installable as a python package and discoverable by pytest's plugin system, instead of asking users to copy the files into their projects.

Provide details that support your chosen implementation, including: breaking changes, alternatives considered, changes to the API, etc.

The only opinionated and "breaking" change is to name the package pytest-aioboto3 instead of aioboto3-testing. This is to follow the standard naming of pytest plugins, and to make it easier to discover by users. The actual test file test_s3.py is kept in the tests directory to separate it from the main code.

I also added support for python 3.7+, because the only 3.9 feature that was being used was the typed Popen, but that is easily fixed with from __future__ import annotations.

If the UI is being changed, please provide screenshots.

Testing

Describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. If this library has unit and/or integration testing, tests should be added for new functionality and existing tests should complete without errors.

poetry install
poetry run pytest

Please include any manual steps for testing end-to-end or functionality not covered by unit/integration tests.

Also include details of the environment this PR was developed in (language/platform/browser version).

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation for new/changed functionality in this PR or in auth0.com/docs
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not master

from .aioboto3_fixtures import moto_patch_session, aioboto3_s3_client
from .moto_fixtures import moto_services

__all__ = ["moto_pathc_session", "aioboto3_s3_client", "moto_services"]
Copy link
Contributor

Choose a reason for hiding this comment

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

typo

Suggested change
__all__ = ["moto_pathc_session", "aioboto3_s3_client", "moto_services"]
__all__ = ["moto_patch_session", "aioboto3_s3_client", "moto_services"]

Copy link
Contributor

@arnaldojvg arnaldojvg left a comment

Choose a reason for hiding this comment

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

Hey, this looks pretty good! Looking forward to have this available on Pypi :)

Copy link
Owner

@phillipuniverse phillipuniverse left a comment

Choose a reason for hiding this comment

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

Really awesome stuff! Thanks so much for contributing!!!

The only opinionated and "breaking" change is to name the package pytest-aioboto3 instead of aioboto3-testing. This is to follow the standard naming of pytest plugins, and to make it easier to discover by users. The actual test file test_s3.py is kept in the tests directory to separate it from the main code.

I agree, great improvement. I went ahead and changed the name of the repo.

You know, I hadn't really planned on putting this on PyPi but I guess I didn't realize how close this was! Thanks for cleaning this up and I will try to get this up on PyPi in the next week or so!

pytest_aioboto3/__init__.py Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
aioboto3 = "^9.5.0"
moto = {extras = ["s3", "server"], version = "^3.1.6"}
types-aiobotocore = {extras = ["s3"], version = "^2.2.0"}
Copy link
Owner

Choose a reason for hiding this comment

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

I'm actually not all that sure about how type dependencies should be distributed. Most of the examples I've seen put them in dev-dependencies but - I guess if they are being used as type annotations you need to distribute them as transitive dependencies?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, there is an explicit import of types_aiobotocore_s3 here, so the package NEEDS to be installed or there will be an import error.

The way I see it, dev dependencies are those that are only needed to run the tests or set up the project locally, while the main dependencies are those required to install and run the main package.

pyproject.toml Show resolved Hide resolved
ocaballeror and others added 2 commits May 17, 2022 10:33
Co-authored-by: Phillip Verheyden <pverheyden@gmail.com>
Co-authored-by: Phillip Verheyden <pverheyden@gmail.com>
Copy link
Owner

@phillipuniverse phillipuniverse left a comment

Choose a reason for hiding this comment

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

Great stuff, thanks for contributing!

@phillipuniverse phillipuniverse merged commit d1977b5 into phillipuniverse:main May 17, 2022
@ocaballeror ocaballeror deleted the package branch May 19, 2022 13:01
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.

None yet

3 participants