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

feat: poetry script for easier test case running #445

Merged
merged 12 commits into from Oct 3, 2022

Conversation

connorjchen
Copy link
Collaborator

@connorjchen connorjchen commented Sep 27, 2022

High Level Overview of Change

Enabled developers to use poetry run test FILE PATH, poetry run test_unit, poetry run test_integration and poetry run test_coverage for testing now

Context of Change

Currently it’s hard to remember how to run tests, it basically requires looking up the instructions in the CONTRIBUTING.md

Instead, it’d be better to write some short poetry scripts that allow you to just do something like poetry run test and poetry run test_integration for unit and integration tests respectively.

Type of Change

  • New feature (non-breaking change which adds functionality)

Test Plan

Ran both commands

tests/poetry_scripts.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@mvadari mvadari left a comment

Choose a reason for hiding this comment

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

Another script to add: running one specific test/test file (you just leave off the discover)

I recommend updating the CI scripts to use poe as well.

@mvadari
Copy link
Collaborator

mvadari commented Sep 28, 2022

I just remembered that I added coverage support to xrpl-py - it would be even better if those could be incorporated into the scripts. You'll just need to modify the scripts to be something like poetry run coverage run -m unittest discover tests/integration && poetry run coverage report -m

Perhaps a script should run both sets of tests just for coverage purposes?

I recommend using these settings:

[tool.coverage.run]
branch = true
source = ["xrpl"] # this might need to be more fine-tuned depending on which set of tests

[tool.coverage.report]
show_missing = true
fail_under = 85
precision = 2

@connorjchen
Copy link
Collaborator Author

connorjchen commented Sep 29, 2022

Did not call poe test_unit in CI files (unit_test.yml and integration_test.yml) because must install poethepoet in yml file and seemed overkill to run every time for checks

@mvadari
Copy link
Collaborator

mvadari commented Sep 29, 2022

Did not call poe test_unit in CI files (unit_test.yml and integration_test.yml) because must install poethepoet in yml file and seemed overkill to run every time for checks

poetry run poe test_unit should work (the CONTRIBUTING instructions should read like that as well - the alternative won't work unless you install poe locally, which we don't need to do). poetry essentially controls its own virtual Python environment, so everything is installed in that environment.

pyproject.toml Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@JST5000 JST5000 left a comment

Choose a reason for hiding this comment

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

LGTM

@connorjchen connorjchen merged commit 96697c1 into XRPLF:master Oct 3, 2022
@connorjchen connorjchen deleted the poetry-tests branch October 3, 2022 14:53
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