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

Import only .py files when importing rules #575

Merged
merged 6 commits into from
Jan 20, 2018

Conversation

austinbyers
Copy link
Contributor

@austinbyers austinbyers commented Jan 19, 2018

to: @ryandeivert
cc: @airbnb/streamalert-maintainers
size: small

Background

Users should be able to have non-Python files in the rules/ directory (e.g. README, REVIEWERS, etc). The current rules import logic imports all files except *.pyc, .* and __init__.*. This means files like rules/README are also imported, which causes an ImportError.

Changes

  • Change rule import logic to import all *.py files in rules/ and matchers/ except __*
  • Refactor rule import logic into 3 unit-testable functions.
  • Rename test_main.py to test_init.py (since it tests LOGGER during __init__.py)
  • Added new unit tests for rule import logic.

Testing

  • Added new unit tests for rule import logic.
  • Verified that the rule integration tests covered the same set of rules as before (all rules are still imported)

@coveralls
Copy link

Coverage Status

Coverage increased (+0.5%) to 95.397% when pulling b71ada5 on austin-allow-non-rules-files into 5cebabd on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.5%) to 95.397% when pulling b71ada5 on austin-allow-non-rules-files into 5cebabd on master.

Copy link
Contributor

@ryandeivert ryandeivert left a comment

Choose a reason for hiding this comment

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

This is great!! Thanks for doing it :)

@coveralls
Copy link

Coverage Status

Coverage increased (+0.5%) to 95.397% when pulling f4f71db on austin-allow-non-rules-files into 5cebabd on master.

@austinbyers austinbyers merged commit a1c171b into master Jan 20, 2018
@austinbyers austinbyers deleted the austin-allow-non-rules-files branch January 20, 2018 00:51
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.

3 participants