aquasecurity / kube-hunter

Hunt for security weaknesses in Kubernetes clusters
Apache License 2.0
4.75k stars 585 forks source link

Pytest failure. #316

Closed abdullahgarcia closed 4 years ago

abdullahgarcia commented 4 years ago

What happened

Running the command "pytest" renders the following message:

pytest: error: unrecognized arguments: --cov=kube_hunter

Environment:

I believe the issue lies in the setup.cfg file, with the line:

-addopts = --cov=kube_hunter

However, if the line is removed, I get the following outcome:

START

============================================= test session starts ============================================== platform darwin -- Python 3.7.4, pytest-5.3.5, py-1.8.1, pluggy-0.13.1 rootdir: /Users/abdullahgarcia/Documents/Workbench/GitHub/kube-hunter, inifile: setup.cfg, testpaths: tests plugins: requests-mock-1.7.0 collected 0 items / 6 errors

==================================================== ERRORS ==================================================== ____ ERROR collecting tests/core/testsubscribe.py ____ ImportError while importing test module "/Users/abdullahgarcia/Documents/Workbench/GitHub/kube-hunter/tests/core/test_subscribe.py". Hint: make sure your test modules/packages have valid Python names. Traceback: tests/core/test_subscribe.py:3: in from kube_hunter.core.types import Hunter E ModuleNotFoundError: No module named "kube_hunter" __ ERROR collecting tests/discovery/test_apiserver.py __ ImportError while importing test module "/Users/abdullahgarcia/Documents/Workbench/GitHub/kube-hunter/tests/discovery/test_apiserver.py". Hint: make sure your test modules/packages have valid Python names. Traceback: tests/discovery/test_apiserver.py:4: in from kube_hunter.modules.discovery.apiserver import ApiServer, ApiServiceDiscovery E ModuleNotFoundError: No module named "kube_hunter" ____ ERROR collecting tests/discovery/test_hosts.py ____ ImportError while importing test module "/Users/abdullahgarcia/Documents/Workbench/GitHub/kube-hunter/tests/discovery/test_hosts.py". Hint: make sure your test modules/packages have valid Python names. Traceback: tests/discovery/test_hosts.py:5: in from kube_hunter.modules.discovery.hosts import FromPodHostDiscovery, RunningAsPodEvent, HostScanEvent, AzureMetadataApi E ModuleNotFoundError: No module named "kube_hunter" _ ERROR collecting tests/hunting/test_apiserver_hunter.py ____ ImportError while importing test module "/Users/abdullahgarcia/Documents/Workbench/GitHub/kube-hunter/tests/hunting/test_apiserver_hunter.py". Hint: make sure your test modules/packages have valid Python names. Traceback: tests/hunting/test_apiserver_hunter.py:4: in from kube_hunter.modules.hunting.apiserver import AccessApiServer, AccessApiServerWithToken, ServerApiAccess, AccessApiServerActive E ModuleNotFoundError: No module named "kube_hunter" __ ERROR collecting tests/hunting/test_cvehunting.py _____ ImportError while importing test module "/Users/abdullahgarcia/Documents/Workbench/GitHub/kube-hunter/tests/hunting/test_cvehunting.py". Hint: make sure your test modules/packages have valid Python names. Traceback: tests/hunting/test_cvehunting.py:4: in from kube_hunter.core.events import handler E ModuleNotFoundError: No module named "kube_hunter" ____ ERROR collecting tests/modules/test_reports.py ImportError while importing test module "/Users/abdullahgarcia/Documents/Workbench/GitHub/kube-hunter/tests/modules/test_reports.py". Hint: make sure your test modules/packages have valid Python names. Traceback: tests/modules/test_reports.py:1: in from kube_hunter.modules.report import get_reporter, get_dispatcher E ModuleNotFoundError: No module named "kube_hunter" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 6 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ============================================== 6 errors in 0.31s ===============================================

END

I'm planning on raising a pull request to bring new active hunters. Should I aim to address this issue within the same pull request or ignore it for now, raise the pull request, and then address this issue on a separate pull request?

Expected behavior

Tests executed successfully and coverage stats presented.

abdullahgarcia commented 4 years ago

Update: the problem was due to an environment issue, I'll close this issue.