diff --git a/src/flake8_requirements/checker.py b/src/flake8_requirements/checker.py index c1b4b4b..db7c975 100644 --- a/src/flake8_requirements/checker.py +++ b/src/flake8_requirements/checker.py @@ -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: @@ -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): @@ -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.