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

Feature/issue 11 start pytest testing #16

Merged

Conversation

frank113
Copy link
Contributor

@frank113 frank113 commented Jun 26, 2023

Summary

This PR provides a starting point to partially address issue #11 . More specifically some of the operations in patterns.py are tested using property-based testing. This PR is intended to be a first step in fully testing this package and provide velocity by accounting for house-keeping items (such as the dev installation type).

Issues Addressed

Changes made

  1. Create a dev installation type in setup.cfg so that development dependencies can be installed as follows:
pip install -e .[dev]
  1. Construct dev package list from an examination of workflows and libraries needed for testing, namely pytest and hypothesis
  2. Add pytest configuration within setup.cfg
  3. Add default hypothesis profile in tests/conftest.py
  4. Create place for common strategy functions in tests/strategies.py
  5. Add unit tests for the following functionality:
  • Set
  • Or
  • Amount (Limited and not property-based at this time)
  • join
  • Range
  1. Add a main workflow to run unit tests either on command or within a PR
  2. Update styling workflow to allow calling by workflow dispatch
  3. Include changes from Bugfix/pass flake8 linting #14 so that all checks pass
  4. Add ESCAPED_CHARACTERS and ValidPatternType to pattern module exports defined in regexfactory/__init__.py

Considerations

  • The builders for all patterns tests generate a string. In a future release we can broaden the scope of these tests to generate a ValidPatternType
  • The main.yml workflow refers to the version of styling.yml within the repository at the time of commit. In the future this will be updated to reflect the master state after styling.yml is merged into master

Other

While the process of unit testing everything in the package will be a long process I hope this PR provides velocity to kick off the process!

Edit: Confirmation of workflow success: https://github.com/frank113/RegexFactory/actions/runs/5374169395/jobs/9749249875

@frank113 frank113 marked this pull request as ready for review June 26, 2023 05:32
@GrandMoff100
Copy link
Owner

Yay! Thank you so much!

@frank113
Copy link
Contributor Author

Needed to sync with current master -- it is ready for review!

Copy link
Owner

@GrandMoff100 GrandMoff100 left a comment

Choose a reason for hiding this comment

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

Looks good

@example(arr=["0", "0"])
def test_matching_or(arr: list):
actual = Or(*arr)
if len(arr) == 1:
Copy link
Owner

Choose a reason for hiding this comment

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

You can remove this if statement and simplify everything to just the for loop because you do the same thing in both cases, I think.

@GrandMoff100 GrandMoff100 merged commit 60820aa into GrandMoff100:master Jun 28, 2023
2 checks passed
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

2 participants