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

Mocked AWS & Github Action #39

Merged
merged 1 commit into from
Oct 29, 2024
Merged

Mocked AWS & Github Action #39

merged 1 commit into from
Oct 29, 2024

Conversation

edsu
Copy link
Contributor

@edsu edsu commented Oct 28, 2024

This PR mocks AWS resources in the test with moto. It also includes a Github Action configuration to run linting and format check with ruff, before running the tests.

Closes #12
Refs #36

@edsu edsu marked this pull request as ready for review October 28, 2024 22:35
@@ -345,6 +331,14 @@ def load_whisper_model(model_name):


if __name__ == "__main__":
dotenv.load_dotenv()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the loading of the dotenv file was moved here so that it doesn't interfere with unit testing, which overrides the runtime environment

@pytest.fixture(scope="function")
def queues(sqs):
sqs.create_queue(QueueName=TODO_QUEUE)
sqs.create_queue(QueueName=DONE_QUEUE)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All of the above is for mocking out STS, SQS and S3 services with moto. moto allows these mocked out services to operate as if they were actually running, but with fake local resources.


bucket = speech_to_text.get_bucket()
for obj in bucket.objects.all():
obj.delete()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we aren't using AWS live anymore, and moto resources are temporary, this cleanup can go away.

@edsu edsu changed the title Mocked AWS Mocked AWS & Github Action Oct 29, 2024
@edsu edsu force-pushed the github-action branch 2 times, most recently from d887601 to 7aeb806 Compare October 29, 2024 02:07
This PR mocks AWS resources in the test with moto. It also includes a GitHub Action
configuration to run linting and format check with ruff, before running
the tests.

Closes #12
Refs #36
@edsu edsu merged commit 9da1cfa into main Oct 29, 2024
1 check passed
@jmartin-sul jmartin-sul deleted the github-action branch October 29, 2024 19:19
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.

Run tests as Github Action
1 participant