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

fix: Adjust moto fixtures to work correctly with scopes and to propag… #193

Merged
merged 1 commit into from
Jul 12, 2023

Conversation

DanCardin
Copy link
Contributor

@DanCardin DanCardin commented Jul 5, 2023

…ate credentials down directly.

Unfortunately this contains a breaking change from the use of the pmr_moto_credentials fixture (removed by this PR), switching to <fixturename>.pmr_credentials, which more closely resembles the interface the rest of the fixtures expose.

i.e.

from pytest_mock_resources.fixture.moto import Session, Credentials

def test_foo(moto: Session, pmr_moto_credentials: Credentials):
    endpoint_url = pmr_moto_credentials.endpoint_url
# ->
def test_foo(moto: Session):
    endpoint_url = moto.pmr_credentials.endpoint_url

The prior interface did/does not play well with different scoping settings, nor does it play well with fixture-local options to the client/resource functions (like `region_name`).

Given the lack of recency of the moto feature and lack of evidence of existing use, the fact that the prior interface was badly designed (non-functional with anything but function scope), and the simplicity of the conversion, the version bump will be a minor release.

@DanCardin DanCardin force-pushed the dc/simplify-moto-fixtures branch 7 times, most recently from ff76a2e to 4676a2c Compare July 12, 2023 15:41
@coveralls
Copy link

coveralls commented Jul 12, 2023

Pull Request Test Coverage Report for Build 5533933721

  • 17 of 17 (100.0%) changed or added relevant lines in 2 files are covered.
  • 6 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.3%) to 90.694%

Files with Coverage Reduction New Missed Lines %
src/pytest_mock_resources/container/base.py 2 82.27%
src/pytest_mock_resources/compat/init.py 4 81.08%
Totals Coverage Status
Change from base Build 5215975220: -0.3%
Covered Lines: 1385
Relevant Lines: 1516

💛 - Coveralls

@DanCardin DanCardin marked this pull request as ready for review July 12, 2023 15:58
@DanCardin DanCardin merged commit ef68ba9 into main Jul 12, 2023
20 checks passed
@DanCardin DanCardin deleted the dc/simplify-moto-fixtures branch July 12, 2023 20:06
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

4 participants