Skip to content

Commit

Permalink
Collect tests requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
arkq committed Nov 29, 2017
1 parent e7387a0 commit f3aab51
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/flake8_requirements/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ def setup(**kw):
# Restore import search path.
sys.path.pop(0)

def get_requirements(self, install=True, extras=True, setup=False):
def get_requirements(
self, install=True, extras=True, setup=False, tests=False):
"""Get package requirements."""
requires = []
if install:
Expand All @@ -180,6 +181,10 @@ def get_requirements(self, install=True, extras=True, setup=False):
requires.extend(parse_requirements(
self.keywords.get('setup_requires', ()),
))
if tests:
requires.extend(parse_requirements(
self.keywords.get('tests_require', ()),
))
return requires

def visit_Call(self, node):
Expand Down Expand Up @@ -309,6 +314,7 @@ def modcmp(lib=(), test=()):

requirements = self.setup.get_requirements(
setup=self.processing_setup_py,
tests=True,
)

# Get 3rd party module names based on requirements.
Expand Down

0 comments on commit f3aab51

Please sign in to comment.