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

Update pytest and moto in Test Container #1624

Closed
4 tasks done
k-macmillan opened this issue Jan 30, 2024 · 4 comments
Closed
4 tasks done

Update pytest and moto in Test Container #1624

k-macmillan opened this issue Jan 30, 2024 · 4 comments

Comments

@k-macmillan
Copy link
Member

k-macmillan commented Jan 30, 2024

User Story - Business Need

New versions of pytest and moto broke our test environment, as such they were pinned to the non-breaking changes temporarily. The purpose of this ticket is to update pytest and moto to their newest versions and fix the breaking changes. This should only affect our tests and should have no bearing on app code.

  • Ticket is understood, and QA has been contacted (if the ticket has a QA label).

User Story(ies)

As a VA Notify engineer
I want current software
So that our code runs smooth and we have access to all features

Additional Info and Resources

Specific to the moto upgrade:

For Moto 5.x:
All decorators have been replaced with mock_aws
The batch_simple decorator has been replaced with: @mock_aws(config={“batch”: {“use_docker”: False}})
The awslambda_simple decorator has been replaced with: @mock_aws(config={“lambda”: {“use_docker”: False}})
When starting the MotoServer, the service-argument (i.e.: motoserver s3) is no longer supported. A single MotoServer-instance can be used for all AWS-services.

Test that fail out include

tests/app/celery/test_scheduled_tasks.py:9: in
from moto import mock_dynamodb
from moto import mock_dynamodb
E ImportError: cannot import name 'mock_dynamodb' from 'moto'

tests/app/letters/test_letter_utils.py:7: in
from moto import mock_s3
from moto import mock_s3
E ImportError: cannot import name 'mock_s3' from 'moto'

tests/lambda_functions/two_way_sms/test_two_way_sms_v2.py:11: in
from moto import mock_ssm
E ImportError: cannot import name 'mock_ssm' from 'moto'

Engineering Checklist

  • pytest upgraded to 8.x (note: it looks like this was upgraded, double0check to be sure)
  • moto upgraded to 5.x
  • All dependencies locked to ~= M.m
    • e.g. pytest ~= 8.0. No third decimal place (patch version), and all contain ~=

Acceptance Criteria

  • pytest and moto upgraded to 8.x and 5.x respectively.
  • After the upgrade, all unit tests pass

Potential Dependencies

1436 must be finished first.

@mjones-oddball
Copy link

@EvanParish
Copy link

I update the dependency and made the necessary changes. There's one test that fails when running locally in a container, but looks like it passes when the tests are run on the PR. I'll continue trying to figure out what's going on with that tomorrow.

The test failing locally is this one: test_fetch_notification_status_for_service_for_day

@EvanParish
Copy link

After running the tests several times today I did not encounter the above test failing anymore. Maybe I was running tests without a clean database? I'm putting this PR up for review once I deploy to dev.

EvanParish added a commit that referenced this issue Jul 18, 2024
@EvanParish
Copy link

PR has been merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants