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

Unit tests won't run #11128

Closed
1 of 3 tasks
xpert98 opened this issue Oct 24, 2024 · 5 comments
Closed
1 of 3 tasks

Unit tests won't run #11128

xpert98 opened this issue Oct 24, 2024 · 5 comments

Comments

@xpert98
Copy link

xpert98 commented Oct 24, 2024

Problem description
Attempting to run a unit test for any parser results in the following error:

======================================================================
ERROR: unittests (unittest.loader._FailedTest.unittests)

ImportError: Failed to import test module: unittests
Traceback (most recent call last):
File "/usr/local/lib/python3.11/unittest/loader.py", line 162, in loadTestsFromName
module = import(module_name)
^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'unittests'


Steps to reproduce
Steps to reproduce the behavior:
The same error occurs when using both of these commands
./dc-unittest.sh --test-case unittests.tools.test__parser.TestParser
docker compose exec uwsgi bash -c 'python manage.py test unittests.tools._parser.TestParser'

This goes for the parser I've written as well as existing unmodified parsers.

Expected behavior
Expected behavior is for the unit test to run.

Deployment method (select with an X)

  • Docker Compose
  • Kubernetes
  • GoDojo

Environment information

  • Operating System: Ubuntu 22.04
  • DefectDojo version (see footer) or commit message: 2.39.1
@manuel-sommer
Copy link
Contributor

I have the same problem. It was introduced in 2.38.0

@kiblik
Copy link
Contributor

kiblik commented Oct 28, 2024

It works on my computer 😄
Can you check where docker-compose.override.yml is pointing? This file (symlink) is set by docker/setEnv.sh script.
It might be connected to the fact that debug env is not available anymore. You need to use dev env for development/debugging/troubleshooting.

@kiblik
Copy link
Contributor

kiblik commented Oct 28, 2024

For context: #10692

Can you confirm and can we close this issue?

manuel-sommer added a commit to manuel-sommer/django-DefectDojo that referenced this issue Oct 28, 2024
@manuel-sommer
Copy link
Contributor

Yes, I can confirm this, but opened a PR to fix the docs.

@mtesauro
Copy link
Contributor

Closing this one as the PR has started getting approvals.

mtesauro pushed a commit that referenced this issue Nov 2, 2024
* fix unittest documentation #11128

* udpate

* Update docs/content/en/contributing/how-to-write-a-parser.md

Co-authored-by: Charles Neill <[email protected]>

* Update docs/content/en/contributing/how-to-write-a-parser.md

Co-authored-by: Charles Neill <[email protected]>

---------

Co-authored-by: Charles Neill <[email protected]>
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

No branches or pull requests

4 participants