Open
Conversation
Remove py35, py36 and add py38 to tox environments. Add enviroment for running pep8 and funcional tests.
Two main issues caused the test execution to fail. Issue 1: The tests were failing due to a relative import not being found, resulting in the following error: ImportError: attempted relative import with no known parent package. Switching to absolute imports, as generally recommended, did not resolve the issue due to a circular reference. The problem arises because a Python file named rate_limit.py exists within the rate_limit module. When trying to import within the module using from rate_limit, it attempts to import itself, leading to the following error: ImportError: cannot import name 'backend' from partially initialized module 'rate_limit' (most likely due to a circular import). Issue 2: Middleware tests require a running Redis database to determine if requests should be rate limited via a Lua script. This commit mocks the result of the Lua script, eliminating the need for an active Redis instance during test execution.
Fix flake8 findings and ignore D107 'Missing docstring in __init__'.
251d473 to
b4095a5
Compare
Github action runs tests and pep8 on each pull request to master. Updated flake8-docstring to latest version as this caused the action execution to fail.
b4095a5 to
b6cae10
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce GitHub Actions for rate limit middleware
This PR adds GitHub Actions to the rate limit middleware, inspired by the Neutron network driver's GitHub Actions setup. It ensures that Pep8 checks and unit tests are automatically executed when a PR is created on the master branch.
As part of enabling these actions, test execution issues were resolved, and all existing Pep8 violations were fixed.