skipIf does not work in test mode #11092

Closed
opened 2025-12-29 21:40:14 +01:00 by adam · 0 comments
Owner

Originally created by @abhi1693 on GitHub (Apr 27, 2025).

Deployment Type

Self-hosted

NetBox Version

v4.2.8

Python Version

3.12

Steps to Reproduce

Ensure PLUGINS is not in configuration.py
run : python manage.py test netbox.tests.test_models

Expected Behavior

Tests finish without any errors

Observed Behavior

(.venv) ➜  netbox git:(v4.2.8) ✗ python manage.py test netbox.tests.test_models                                                                                                                            git:(v4.2.8|…1 
Traceback (most recent call last):
  File "/home/asaharan/PycharmProjects/netbox/netbox/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/asaharan/PycharmProjects/netbox/.venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/home/asaharan/PycharmProjects/netbox/.venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/asaharan/PycharmProjects/netbox/.venv/lib/python3.12/site-packages/django/core/management/commands/test.py", line 24, in run_from_argv
    super().run_from_argv(argv)
  File "/home/asaharan/PycharmProjects/netbox/.venv/lib/python3.12/site-packages/django/core/management/base.py", line 413, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/asaharan/PycharmProjects/netbox/.venv/lib/python3.12/site-packages/django/core/management/base.py", line 459, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/asaharan/PycharmProjects/netbox/.venv/lib/python3.12/site-packages/django/core/management/commands/test.py", line 68, in handle
    failures = test_runner.run_tests(test_labels)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/asaharan/PycharmProjects/netbox/.venv/lib/python3.12/site-packages/django/test/runner.py", line 1054, in run_tests
    suite = self.build_suite(test_labels)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/asaharan/PycharmProjects/netbox/.venv/lib/python3.12/site-packages/django/test/runner.py", line 909, in build_suite
    tests = self.load_tests_for_label(label, discover_kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/asaharan/PycharmProjects/netbox/.venv/lib/python3.12/site-packages/django/test/runner.py", line 867, in load_tests_for_label
    tests = self.test_loader.loadTestsFromName(label)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/unittest/loader.py", line 137, in loadTestsFromName
    module = __import__(module_name)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/asaharan/PycharmProjects/netbox/netbox/netbox/tests/test_models.py", line 7, in <module>
    from netbox.tests.dummy_plugin.models import DummyNetBoxModel
  File "/home/asaharan/PycharmProjects/netbox/netbox/netbox/tests/dummy_plugin/models.py", line 6, in <module>
    class DummyModel(models.Model):
  File "/home/asaharan/PycharmProjects/netbox/.venv/lib/python3.12/site-packages/django/db/models/base.py", line 134, in __new__
    raise RuntimeError(
RuntimeError: Model class netbox.tests.dummy_plugin.models.DummyModel doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
Originally created by @abhi1693 on GitHub (Apr 27, 2025). ### Deployment Type Self-hosted ### NetBox Version v4.2.8 ### Python Version 3.12 ### Steps to Reproduce Ensure `PLUGINS` is not in `configuration.py` run : `python manage.py test netbox.tests.test_models` ### Expected Behavior Tests finish without any errors ### Observed Behavior ``` (.venv) ➜ netbox git:(v4.2.8) ✗ python manage.py test netbox.tests.test_models git:(v4.2.8|…1 Traceback (most recent call last): File "/home/asaharan/PycharmProjects/netbox/netbox/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/home/asaharan/PycharmProjects/netbox/.venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/home/asaharan/PycharmProjects/netbox/.venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/asaharan/PycharmProjects/netbox/.venv/lib/python3.12/site-packages/django/core/management/commands/test.py", line 24, in run_from_argv super().run_from_argv(argv) File "/home/asaharan/PycharmProjects/netbox/.venv/lib/python3.12/site-packages/django/core/management/base.py", line 413, in run_from_argv self.execute(*args, **cmd_options) File "/home/asaharan/PycharmProjects/netbox/.venv/lib/python3.12/site-packages/django/core/management/base.py", line 459, in execute output = self.handle(*args, **options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/asaharan/PycharmProjects/netbox/.venv/lib/python3.12/site-packages/django/core/management/commands/test.py", line 68, in handle failures = test_runner.run_tests(test_labels) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/asaharan/PycharmProjects/netbox/.venv/lib/python3.12/site-packages/django/test/runner.py", line 1054, in run_tests suite = self.build_suite(test_labels) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/asaharan/PycharmProjects/netbox/.venv/lib/python3.12/site-packages/django/test/runner.py", line 909, in build_suite tests = self.load_tests_for_label(label, discover_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/asaharan/PycharmProjects/netbox/.venv/lib/python3.12/site-packages/django/test/runner.py", line 867, in load_tests_for_label tests = self.test_loader.loadTestsFromName(label) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/unittest/loader.py", line 137, in loadTestsFromName module = __import__(module_name) ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/asaharan/PycharmProjects/netbox/netbox/netbox/tests/test_models.py", line 7, in <module> from netbox.tests.dummy_plugin.models import DummyNetBoxModel File "/home/asaharan/PycharmProjects/netbox/netbox/netbox/tests/dummy_plugin/models.py", line 6, in <module> class DummyModel(models.Model): File "/home/asaharan/PycharmProjects/netbox/.venv/lib/python3.12/site-packages/django/db/models/base.py", line 134, in __new__ raise RuntimeError( RuntimeError: Model class netbox.tests.dummy_plugin.models.DummyModel doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS. ```
adam closed this issue 2025-12-29 21:40:14 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11092