nautobot 2.4.4__py3-none-any.whl → 2.4.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nautobot/__init__.py +19 -3
- nautobot/core/api/mixins.py +10 -0
- nautobot/core/celery/__init__.py +5 -3
- nautobot/core/celery/encoders.py +2 -2
- nautobot/core/forms/fields.py +21 -5
- nautobot/core/forms/utils.py +1 -0
- nautobot/core/jobs/__init__.py +3 -2
- nautobot/core/jobs/bulk_actions.py +1 -1
- nautobot/core/management/commands/generate_test_data.py +1 -1
- nautobot/core/models/name_color_content_types.py +9 -0
- nautobot/core/models/validators.py +7 -0
- nautobot/core/settings.py +0 -14
- nautobot/core/settings.yaml +0 -28
- nautobot/core/tables.py +6 -1
- nautobot/core/templates/generic/object_retrieve.html +1 -1
- nautobot/core/testing/__init__.py +2 -0
- nautobot/core/testing/api.py +18 -0
- nautobot/core/testing/mixins.py +9 -0
- nautobot/core/tests/nautobot_config.py +0 -2
- nautobot/core/tests/runner.py +17 -140
- nautobot/core/tests/test_api.py +4 -4
- nautobot/core/tests/test_authentication.py +83 -4
- nautobot/core/tests/test_forms.py +11 -8
- nautobot/core/tests/test_graphql.py +9 -0
- nautobot/core/tests/test_jobs.py +33 -27
- nautobot/core/ui/object_detail.py +31 -0
- nautobot/dcim/factory.py +2 -0
- nautobot/dcim/filters/__init__.py +5 -0
- nautobot/dcim/forms.py +17 -1
- nautobot/dcim/migrations/0068_alter_softwareimagefile_download_url.py +19 -0
- nautobot/dcim/migrations/0069_softwareimagefile_external_integration.py +25 -0
- nautobot/dcim/models/devices.py +9 -2
- nautobot/dcim/tables/devices.py +1 -0
- nautobot/dcim/templates/dcim/softwareimagefile_retrieve.html +4 -0
- nautobot/dcim/tests/test_api.py +74 -31
- nautobot/dcim/tests/test_filters.py +2 -0
- nautobot/dcim/tests/test_jobs.py +4 -6
- nautobot/dcim/tests/test_models.py +65 -0
- nautobot/dcim/tests/test_views.py +3 -0
- nautobot/extras/choices.py +8 -3
- nautobot/extras/forms/forms.py +7 -3
- nautobot/extras/jobs.py +181 -103
- nautobot/extras/management/utils.py +13 -2
- nautobot/extras/models/datasources.py +4 -1
- nautobot/extras/models/jobs.py +20 -17
- nautobot/extras/plugins/marketplace_manifest.yml +18 -0
- nautobot/extras/tables.py +29 -34
- nautobot/extras/templates/extras/inc/panel_changelog.html +1 -1
- nautobot/extras/templates/extras/inc/panel_jobhistory.html +1 -1
- nautobot/extras/templates/extras/status.html +1 -37
- nautobot/extras/test_jobs/atomic_transaction.py +6 -6
- nautobot/extras/test_jobs/fail.py +75 -1
- nautobot/extras/tests/integration/test_notes.py +1 -1
- nautobot/extras/tests/test_api.py +23 -8
- nautobot/extras/tests/test_changelog.py +4 -4
- nautobot/extras/tests/test_customfields.py +3 -0
- nautobot/extras/tests/test_datasources.py +64 -54
- nautobot/extras/tests/test_jobs.py +69 -62
- nautobot/extras/tests/test_models.py +1 -1
- nautobot/extras/tests/test_plugins.py +19 -13
- nautobot/extras/tests/test_relationships.py +14 -5
- nautobot/extras/tests/test_tags.py +2 -2
- nautobot/extras/tests/test_views.py +15 -6
- nautobot/extras/urls.py +1 -30
- nautobot/extras/views.py +17 -55
- nautobot/ipam/forms.py +15 -0
- nautobot/ipam/querysets.py +6 -0
- nautobot/ipam/tables.py +6 -2
- nautobot/ipam/templates/ipam/namespace_retrieve.html +0 -41
- nautobot/ipam/templates/ipam/rir.html +1 -43
- nautobot/ipam/templates/ipam/service.html +2 -46
- nautobot/ipam/templates/ipam/service_edit.html +1 -17
- nautobot/ipam/templates/ipam/service_retrieve.html +7 -0
- nautobot/ipam/tests/migration/__init__.py +0 -0
- nautobot/ipam/tests/migration/test_migrations.py +510 -0
- nautobot/ipam/tests/test_api.py +66 -36
- nautobot/ipam/tests/test_filters.py +0 -10
- nautobot/ipam/tests/test_models.py +16 -0
- nautobot/ipam/tests/test_views.py +44 -2
- nautobot/ipam/urls.py +2 -67
- nautobot/ipam/utils/migrations.py +185 -152
- nautobot/ipam/utils/testing.py +177 -0
- nautobot/ipam/views.py +119 -198
- nautobot/project-static/docs/code-reference/nautobot/apps/jobs.html +43 -5
- nautobot/project-static/docs/code-reference/nautobot/apps/models.html +47 -0
- nautobot/project-static/docs/code-reference/nautobot/apps/tables.html +18 -0
- nautobot/project-static/docs/code-reference/nautobot/apps/testing.html +35 -0
- nautobot/project-static/docs/code-reference/nautobot/apps/ui.html +63 -0
- nautobot/project-static/docs/development/apps/api/testing.html +0 -87
- nautobot/project-static/docs/development/apps/migration/dependency-updates.html +1 -1
- nautobot/project-static/docs/development/core/best-practices.html +3 -3
- nautobot/project-static/docs/development/core/getting-started.html +78 -107
- nautobot/project-static/docs/development/core/release-checklist.html +1 -1
- nautobot/project-static/docs/development/core/style-guide.html +1 -1
- nautobot/project-static/docs/development/core/testing.html +24 -198
- nautobot/project-static/docs/development/jobs/index.html +27 -14
- nautobot/project-static/docs/media/user-guide/administration/getting-started/nautobot-cloud.png +0 -0
- nautobot/project-static/docs/objects.inv +0 -0
- nautobot/project-static/docs/overview/application_stack.html +1 -1
- nautobot/project-static/docs/release-notes/version-2.4.html +409 -1
- nautobot/project-static/docs/requirements.txt +1 -1
- nautobot/project-static/docs/search/search_index.json +1 -1
- nautobot/project-static/docs/sitemap.xml +290 -290
- nautobot/project-static/docs/sitemap.xml.gz +0 -0
- nautobot/project-static/docs/user-guide/administration/configuration/settings.html +2 -48
- nautobot/project-static/docs/user-guide/administration/guides/permissions.html +71 -0
- nautobot/project-static/docs/user-guide/administration/installation/http-server.html +3 -1
- nautobot/project-static/docs/user-guide/administration/installation/index.html +257 -16
- nautobot/project-static/docs/user-guide/administration/tools/nautobot-server.html +1 -1
- nautobot/project-static/docs/user-guide/administration/upgrading/upgrading.html +2 -2
- nautobot/project-static/docs/user-guide/core-data-model/dcim/softwareimagefile.html +4 -0
- nautobot/project-static/docs/user-guide/feature-guides/contacts-and-teams.html +11 -11
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/creating-devices.html +8 -8
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/creating-location-types-and-locations.html +1 -0
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/interfaces.html +40 -25
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/ipam.html +4 -4
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/platforms.html +1 -1
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/search-bar.html +77 -5
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/tenants.html +1 -1
- nautobot/project-static/docs/user-guide/feature-guides/getting-started/vlans-and-vlan-groups.html +0 -1
- nautobot/project-static/docs/user-guide/feature-guides/git-data-source.html +1 -1
- nautobot/project-static/docs/user-guide/index.html +89 -2
- nautobot/project-static/docs/user-guide/platform-functionality/webhook.html +207 -122
- nautobot/virtualization/forms.py +20 -0
- nautobot/virtualization/templates/virtualization/clustergroup.html +1 -39
- nautobot/virtualization/templates/virtualization/clustertype.html +1 -0
- nautobot/virtualization/tests/test_api.py +14 -3
- nautobot/virtualization/tests/test_views.py +10 -2
- nautobot/virtualization/urls.py +10 -93
- nautobot/virtualization/views.py +33 -72
- {nautobot-2.4.4.dist-info → nautobot-2.4.6.dist-info}/METADATA +8 -7
- {nautobot-2.4.4.dist-info → nautobot-2.4.6.dist-info}/RECORD +137 -132
- {nautobot-2.4.4.dist-info → nautobot-2.4.6.dist-info}/WHEEL +1 -1
- nautobot/core/tests/performance_baselines.yml +0 -8900
- nautobot/ipam/tests/test_migrations.py +0 -462
- /nautobot/ipam/templates/ipam/{namespace_ipaddresses.html → namespace_ip_addresses.html} +0 -0
- {nautobot-2.4.4.dist-info → nautobot-2.4.6.dist-info}/LICENSE.txt +0 -0
- {nautobot-2.4.4.dist-info → nautobot-2.4.6.dist-info}/NOTICE +0 -0
- {nautobot-2.4.4.dist-info → nautobot-2.4.6.dist-info}/entry_points.txt +0 -0
|
@@ -8323,36 +8323,21 @@
|
|
|
8323
8323
|
<ul class="md-nav__list">
|
|
8324
8324
|
|
|
8325
8325
|
<li class="md-nav__item">
|
|
8326
|
-
<a href="#
|
|
8327
|
-
<span class="md-ellipsis">
|
|
8328
|
-
Unit Tests
|
|
8329
|
-
</span>
|
|
8330
|
-
</a>
|
|
8331
|
-
|
|
8332
|
-
<nav class="md-nav" aria-label="Unit Tests">
|
|
8333
|
-
<ul class="md-nav__list">
|
|
8334
|
-
|
|
8335
|
-
<li class="md-nav__item">
|
|
8336
|
-
<a href="#useful-unit-test-parameters" class="md-nav__link">
|
|
8326
|
+
<a href="#test-execution-examples" class="md-nav__link">
|
|
8337
8327
|
<span class="md-ellipsis">
|
|
8338
|
-
|
|
8328
|
+
Test Execution Examples
|
|
8339
8329
|
</span>
|
|
8340
8330
|
</a>
|
|
8341
8331
|
|
|
8342
8332
|
</li>
|
|
8343
8333
|
|
|
8344
8334
|
<li class="md-nav__item">
|
|
8345
|
-
<a href="#unit-
|
|
8335
|
+
<a href="#unit-tests" class="md-nav__link">
|
|
8346
8336
|
<span class="md-ellipsis">
|
|
8347
|
-
Unit
|
|
8337
|
+
Unit Tests
|
|
8348
8338
|
</span>
|
|
8349
8339
|
</a>
|
|
8350
8340
|
|
|
8351
|
-
</li>
|
|
8352
|
-
|
|
8353
|
-
</ul>
|
|
8354
|
-
</nav>
|
|
8355
|
-
|
|
8356
8341
|
</li>
|
|
8357
8342
|
|
|
8358
8343
|
<li class="md-nav__item">
|
|
@@ -8377,6 +8362,15 @@
|
|
|
8377
8362
|
</ul>
|
|
8378
8363
|
</nav>
|
|
8379
8364
|
|
|
8365
|
+
</li>
|
|
8366
|
+
|
|
8367
|
+
<li class="md-nav__item">
|
|
8368
|
+
<a href="#migration-tests" class="md-nav__link">
|
|
8369
|
+
<span class="md-ellipsis">
|
|
8370
|
+
Migration Tests
|
|
8371
|
+
</span>
|
|
8372
|
+
</a>
|
|
8373
|
+
|
|
8380
8374
|
</li>
|
|
8381
8375
|
|
|
8382
8376
|
</ul>
|
|
@@ -9949,36 +9943,21 @@
|
|
|
9949
9943
|
<ul class="md-nav__list">
|
|
9950
9944
|
|
|
9951
9945
|
<li class="md-nav__item">
|
|
9952
|
-
<a href="#
|
|
9946
|
+
<a href="#test-execution-examples" class="md-nav__link">
|
|
9953
9947
|
<span class="md-ellipsis">
|
|
9954
|
-
|
|
9955
|
-
</span>
|
|
9956
|
-
</a>
|
|
9957
|
-
|
|
9958
|
-
<nav class="md-nav" aria-label="Unit Tests">
|
|
9959
|
-
<ul class="md-nav__list">
|
|
9960
|
-
|
|
9961
|
-
<li class="md-nav__item">
|
|
9962
|
-
<a href="#useful-unit-test-parameters" class="md-nav__link">
|
|
9963
|
-
<span class="md-ellipsis">
|
|
9964
|
-
Useful Unit Test Parameters
|
|
9948
|
+
Test Execution Examples
|
|
9965
9949
|
</span>
|
|
9966
9950
|
</a>
|
|
9967
9951
|
|
|
9968
9952
|
</li>
|
|
9969
9953
|
|
|
9970
9954
|
<li class="md-nav__item">
|
|
9971
|
-
<a href="#unit-
|
|
9955
|
+
<a href="#unit-tests" class="md-nav__link">
|
|
9972
9956
|
<span class="md-ellipsis">
|
|
9973
|
-
Unit
|
|
9957
|
+
Unit Tests
|
|
9974
9958
|
</span>
|
|
9975
9959
|
</a>
|
|
9976
9960
|
|
|
9977
|
-
</li>
|
|
9978
|
-
|
|
9979
|
-
</ul>
|
|
9980
|
-
</nav>
|
|
9981
|
-
|
|
9982
9961
|
</li>
|
|
9983
9962
|
|
|
9984
9963
|
<li class="md-nav__item">
|
|
@@ -10003,6 +9982,15 @@
|
|
|
10003
9982
|
</ul>
|
|
10004
9983
|
</nav>
|
|
10005
9984
|
|
|
9985
|
+
</li>
|
|
9986
|
+
|
|
9987
|
+
<li class="md-nav__item">
|
|
9988
|
+
<a href="#migration-tests" class="md-nav__link">
|
|
9989
|
+
<span class="md-ellipsis">
|
|
9990
|
+
Migration Tests
|
|
9991
|
+
</span>
|
|
9992
|
+
</a>
|
|
9993
|
+
|
|
10006
9994
|
</li>
|
|
10007
9995
|
|
|
10008
9996
|
</ul>
|
|
@@ -10286,7 +10274,7 @@
|
|
|
10286
10274
|
<a id="__codelineno-14-15" name="__codelineno-14-15" href="#__codelineno-14-15"></a> docker-push Tags and pushes docker images to the appropriate repos, intended for release use only.
|
|
10287
10275
|
<a id="__codelineno-14-16" name="__codelineno-14-16" href="#__codelineno-14-16"></a> dumpdata Dump data from database to db_output file.
|
|
10288
10276
|
<a id="__codelineno-14-17" name="__codelineno-14-17" href="#__codelineno-14-17"></a> hadolint Check Dockerfile for hadolint compliance and other style issues.
|
|
10289
|
-
<a id="__codelineno-14-18" name="__codelineno-14-18" href="#__codelineno-14-18"></a>
|
|
10277
|
+
<a id="__codelineno-14-18" name="__codelineno-14-18" href="#__codelineno-14-18"></a> lint Run all linters.
|
|
10290
10278
|
<a id="__codelineno-14-19" name="__codelineno-14-19" href="#__codelineno-14-19"></a> loaddata Load data from file.
|
|
10291
10279
|
<a id="__codelineno-14-20" name="__codelineno-14-20" href="#__codelineno-14-20"></a> logs View the logs of a docker compose service.
|
|
10292
10280
|
<a id="__codelineno-14-21" name="__codelineno-14-21" href="#__codelineno-14-21"></a> makemigrations Perform makemigrations operation in Django.
|
|
@@ -10294,18 +10282,18 @@
|
|
|
10294
10282
|
<a id="__codelineno-14-23" name="__codelineno-14-23" href="#__codelineno-14-23"></a> migrate Perform migrate operation in Django.
|
|
10295
10283
|
<a id="__codelineno-14-24" name="__codelineno-14-24" href="#__codelineno-14-24"></a> migration-test Test database migration from a given dataset to latest Nautobot schema.
|
|
10296
10284
|
<a id="__codelineno-14-25" name="__codelineno-14-25" href="#__codelineno-14-25"></a> nbshell Launch an interactive Nautobot shell.
|
|
10297
|
-
<a id="__codelineno-14-26" name="__codelineno-14-26" href="#__codelineno-14-26"></a>
|
|
10298
|
-
<a id="__codelineno-14-27" name="__codelineno-14-27" href="#__codelineno-14-27"></a>
|
|
10299
|
-
<a id="__codelineno-14-28" name="__codelineno-14-28" href="#__codelineno-14-28"></a>
|
|
10300
|
-
<a id="__codelineno-14-29" name="__codelineno-14-29" href="#__codelineno-14-29"></a>
|
|
10301
|
-
<a id="__codelineno-14-30" name="__codelineno-14-30" href="#__codelineno-14-30"></a>
|
|
10302
|
-
<a id="__codelineno-14-31" name="__codelineno-14-31" href="#__codelineno-14-31"></a>
|
|
10303
|
-
<a id="__codelineno-14-32" name="__codelineno-14-32" href="#__codelineno-14-32"></a>
|
|
10304
|
-
<a id="__codelineno-14-33" name="__codelineno-14-33" href="#__codelineno-14-33"></a>
|
|
10305
|
-
<a id="__codelineno-14-34" name="__codelineno-14-34" href="#__codelineno-14-34"></a>
|
|
10306
|
-
<a id="__codelineno-14-35" name="__codelineno-14-35" href="#__codelineno-14-35"></a>
|
|
10307
|
-
<a id="__codelineno-14-36" name="__codelineno-14-36" href="#__codelineno-14-36"></a>
|
|
10308
|
-
<a id="__codelineno-14-37" name="__codelineno-14-37" href="#__codelineno-14-37"></a>
|
|
10285
|
+
<a id="__codelineno-14-26" name="__codelineno-14-26" href="#__codelineno-14-26"></a> open-docs-web Navigate to the mkdocs interface in your web browser.
|
|
10286
|
+
<a id="__codelineno-14-27" name="__codelineno-14-27" href="#__codelineno-14-27"></a> open-nautobot-web Navigate to the Nautobot interface in your web browser.
|
|
10287
|
+
<a id="__codelineno-14-28" name="__codelineno-14-28" href="#__codelineno-14-28"></a> open-selenium-vnc Navigate to the selenium VNC browser view.
|
|
10288
|
+
<a id="__codelineno-14-29" name="__codelineno-14-29" href="#__codelineno-14-29"></a> post-upgrade Performs Nautobot common post-upgrade operations using a single entrypoint.
|
|
10289
|
+
<a id="__codelineno-14-30" name="__codelineno-14-30" href="#__codelineno-14-30"></a> pylint Perform static analysis of Nautobot code.
|
|
10290
|
+
<a id="__codelineno-14-31" name="__codelineno-14-31" href="#__codelineno-14-31"></a> restart Gracefully restart containers.
|
|
10291
|
+
<a id="__codelineno-14-32" name="__codelineno-14-32" href="#__codelineno-14-32"></a> ruff Run ruff to perform code formatting and linting.
|
|
10292
|
+
<a id="__codelineno-14-33" name="__codelineno-14-33" href="#__codelineno-14-33"></a> serve-docs Runs local instance of mkdocs serve on port 8001 (ctrl-c to stop).
|
|
10293
|
+
<a id="__codelineno-14-34" name="__codelineno-14-34" href="#__codelineno-14-34"></a> showmigrations Perform showmigrations operation in Django.
|
|
10294
|
+
<a id="__codelineno-14-35" name="__codelineno-14-35" href="#__codelineno-14-35"></a> start Start Nautobot and its dependencies in detached mode.
|
|
10295
|
+
<a id="__codelineno-14-36" name="__codelineno-14-36" href="#__codelineno-14-36"></a> stop Stop Nautobot and its dependencies.
|
|
10296
|
+
<a id="__codelineno-14-37" name="__codelineno-14-37" href="#__codelineno-14-37"></a> tests Run Nautobot automated tests.
|
|
10309
10297
|
<a id="__codelineno-14-38" name="__codelineno-14-38" href="#__codelineno-14-38"></a> version Show the version of Nautobot Python package or bump it when a valid bump rule is provided.
|
|
10310
10298
|
<a id="__codelineno-14-39" name="__codelineno-14-39" href="#__codelineno-14-39"></a> vscode Launch Visual Studio Code with the appropriate Environment variables to run in a container.
|
|
10311
10299
|
<a id="__codelineno-14-40" name="__codelineno-14-40" href="#__codelineno-14-40"></a> yamllint Run yamllint to validate formatting applies to YAML standards.
|
|
@@ -10643,11 +10631,38 @@
|
|
|
10643
10631
|
<a id="__codelineno-41-5" name="__codelineno-41-5" href="#__codelineno-41-5"></a>Installing the current project: nautobot (1.0.0-beta.2)
|
|
10644
10632
|
</code></pre></div>
|
|
10645
10633
|
<h3 id="running-tests">Running Tests<a class="headerlink" href="#running-tests" title="Permanent link">¶</a></h3>
|
|
10646
|
-
<p>Throughout the course of development, it's a good idea to occasionally run Nautobot's test suite to catch any potential errors. Tests come in
|
|
10634
|
+
<p>Throughout the course of development, it's a good idea to occasionally run Nautobot's test suite to catch any potential errors. Tests in Nautobot come in three primary flavors: Unit tests, integration tests, and migration tests. Most commonly you'll run unit tests, integration tests less frequently, and migration tests more rarely still.</p>
|
|
10647
10635
|
<p>For information about <strong>writing</strong> tests, refer to the <a href="testing.html">testing documentation</a>.</p>
|
|
10636
|
+
<p>All three types of tests are executable via the <code>invoke tests</code> (or, if using the virtual environment workflow, <code>nautobot-server test</code>) command with appropriate parameters. These commands also support many optional parameters to influence the testing behavior. Careful use of these parameters can greatly reduce the time it takes to run and re-run tests during development. Some specific examples are provided below, but for an up-to-date summary of parameters, you can always run <code>invoke tests --help</code>.</p>
|
|
10637
|
+
<h4 id="test-execution-examples">Test Execution Examples<a class="headerlink" href="#test-execution-examples" title="Permanent link">¶</a></h4>
|
|
10638
|
+
<p>The simplest command <strong>runs all unit tests</strong> (not including integration and migration tests). This includes by default a number of performance optimizations such as <a href="testing.html#factory-caching">caching test factory data to disk</a>, keeping and reusing the database schema between successive reruns, and executing tests in parallel across available CPU cores:</p>
|
|
10639
|
+
<div class="highlight"><pre><span></span><code><a id="__codelineno-42-1" name="__codelineno-42-1" href="#__codelineno-42-1"></a>invoke tests
|
|
10640
|
+
<a id="__codelineno-42-2" name="__codelineno-42-2" href="#__codelineno-42-2"></a># functionally equivalent to explicitly setting the below flags:
|
|
10641
|
+
<a id="__codelineno-42-3" name="__codelineno-42-3" href="#__codelineno-42-3"></a>invoke tests --cache-test-fixtures --keepdb --buffer --parallel
|
|
10642
|
+
</code></pre></div>
|
|
10643
|
+
<p>To limit the test to a specific <strong>subset of test cases</strong> by pattern or label, you can use the <code>--label</code> or <code>--pattern</code> options. You can also instruct the test execution to <strong>stop after the first failure</strong> (if any) occurs, rather than running to completion:</p>
|
|
10644
|
+
<div class="highlight"><pre><span></span><code><a id="__codelineno-43-1" name="__codelineno-43-1" href="#__codelineno-43-1"></a>invoke tests --pattern Controller
|
|
10645
|
+
<a id="__codelineno-43-2" name="__codelineno-43-2" href="#__codelineno-43-2"></a>invoke tests --label nautobot.core.tests.dcim.test_views.DeviceTestCase
|
|
10646
|
+
<a id="__codelineno-43-3" name="__codelineno-43-3" href="#__codelineno-43-3"></a>invoke tests --failfast
|
|
10647
|
+
</code></pre></div>
|
|
10648
|
+
<p>Once the Nautobot static documentation has been generated once (a prerequisite for certain tests), you can <strong>skip the documentation build</strong> if you haven't made any changes to the documentation:</p>
|
|
10649
|
+
<div class="highlight"><pre><span></span><code><a id="__codelineno-44-1" name="__codelineno-44-1" href="#__codelineno-44-1"></a>invoke tests --skip-docs-build
|
|
10650
|
+
</code></pre></div>
|
|
10651
|
+
<p>To limit the CPU consumption on your system, you can <strong>restrict the number of parallel workers</strong> and/or <strong>run tests serially</strong>:</p>
|
|
10652
|
+
<div class="highlight"><pre><span></span><code><a id="__codelineno-45-1" name="__codelineno-45-1" href="#__codelineno-45-1"></a>invoke tests --parallel-workers 4
|
|
10653
|
+
<a id="__codelineno-45-2" name="__codelineno-45-2" href="#__codelineno-45-2"></a>invoke tests --no-parallel
|
|
10654
|
+
</code></pre></div>
|
|
10655
|
+
<p>When actively updating models or migrations, you may need to <strong>not reuse the database from the previous test run</strong>, but instead recreate it, and may also need to force <strong>regeneration of the test factory data</strong>:</p>
|
|
10656
|
+
<div class="highlight"><pre><span></span><code><a id="__codelineno-46-1" name="__codelineno-46-1" href="#__codelineno-46-1"></a>invoke tests --no-reusedb
|
|
10657
|
+
<a id="__codelineno-46-2" name="__codelineno-46-2" href="#__codelineno-46-2"></a>invoke tests --no-cache-test-fixtures
|
|
10658
|
+
</code></pre></div>
|
|
10659
|
+
<p>By default, to keep the test output concise, stdout and stderr for tests are not displayed to your terminal, and while executing, only a single character (<code>.</code> for successful tests, <code>F</code> for failures, and <code>E</code> for errors) is printed per executed test case. If you're <strong>debugging code with <code>breakpoint()</code></strong> you need to use <code>--no-buffer</code> to allow output to the terminal when a breakpoint is reached, and when troubleshooting tests in general, it may be useful to <strong>enable more verbose output from the test runner</strong>:</p>
|
|
10660
|
+
<div class="highlight"><pre><span></span><code><a id="__codelineno-47-1" name="__codelineno-47-1" href="#__codelineno-47-1"></a>invoke tests --no-buffer
|
|
10661
|
+
<a id="__codelineno-47-2" name="__codelineno-47-2" href="#__codelineno-47-2"></a>invoke tests --verbose
|
|
10662
|
+
</code></pre></div>
|
|
10648
10663
|
<h4 id="unit-tests">Unit Tests<a class="headerlink" href="#unit-tests" title="Permanent link">¶</a></h4>
|
|
10649
10664
|
<p>Unit tests are automated tests written and run to ensure that a section of the Nautobot application (known as the "unit") meets its design and behaves as intended and expected. Most commonly as a developer of or contributor to Nautobot you will be writing unit tests to exercise the code you have written. Unit tests are not meant to test how the application behaves, only the individual blocks of code, therefore use of mock data and phony connections is common in unit test code. As a guiding principle, unit tests should be fast, because they will be executed quite often.</p>
|
|
10650
|
-
<p>Unit tests are run using the <code>invoke
|
|
10665
|
+
<p>Unit tests are run using the <code>invoke tests</code> command (if using the Docker development environment) or the <code>nautobot-server test</code> command:</p>
|
|
10651
10666
|
<table>
|
|
10652
10667
|
<thead>
|
|
10653
10668
|
<tr>
|
|
@@ -10657,51 +10672,15 @@
|
|
|
10657
10672
|
</thead>
|
|
10658
10673
|
<tbody>
|
|
10659
10674
|
<tr>
|
|
10660
|
-
<td><code>invoke
|
|
10675
|
+
<td><code>invoke tests</code></td>
|
|
10661
10676
|
<td><code>nautobot-server --config=nautobot/core/tests/nautobot_config.py test nautobot</code></td>
|
|
10662
10677
|
</tr>
|
|
10663
10678
|
</tbody>
|
|
10664
10679
|
</table>
|
|
10665
10680
|
<div class="admonition info">
|
|
10666
10681
|
<p class="admonition-title">Info</p>
|
|
10667
|
-
<p>By default <code>invoke
|
|
10682
|
+
<p>By default <code>invoke tests</code> will start and run the unit tests inside the Docker development container; this ensures that PostgreSQL and Redis servers are available during the test. However, if you have your environment configured such that <code>nautobot-server</code> can run locally, outside of the Docker environment, you may wish to set the environment variable <code>INVOKE_NAUTOBOT_LOCAL=True</code> to execute these tests in your local environment instead.</p>
|
|
10668
10683
|
</div>
|
|
10669
|
-
<h5 id="useful-unit-test-parameters">Useful Unit Test Parameters<a class="headerlink" href="#useful-unit-test-parameters" title="Permanent link">¶</a></h5>
|
|
10670
|
-
<p>The <code>invoke unittest</code> command supports a number of optional parameters to influence its behavior. Careful use of these parameters can greatly reduce the time it takes to run and re-run tests during development.</p>
|
|
10671
|
-
<ul>
|
|
10672
|
-
<li><code>--failfast</code> - Fail as soon as any test failure or error condition is encountered, instead of running to completion.</li>
|
|
10673
|
-
<li><code>--label <module.path></code> - Only run the specific subset of tests. Can be broad (<code>--label nautobot.core.tests</code>) or specific (<code>--label nautobot.core.tests.test_graphql.GraphQLQueryTestCase</code>).</li>
|
|
10674
|
-
<li><code>--no-buffer</code> - Allow stdout/stderr output from the test to be seen in your terminal, instead of being hidden. <strong>If you're debugging code with <code>breakpoint()</code>, you should use this option, as otherwise you'll never see the breakpoint happen.</strong></li>
|
|
10675
|
-
<li><code>--no-cache-test-fixtures</code> - Prevent caching <a href="testing.html#factory-caching">test factory data</a> to disk, or if a cache is already present, prevent loading from that cache when initializing the test environment. <strong>The <code>--no-cache-test-fixtures</code> option is mandatory if you're actively making changes to factories or model migrations.</strong></li>
|
|
10676
|
-
<li><code>--no-keepdb</code> - Prevent saving the initialized test database after a test run for later reuse in a test re-run.</li>
|
|
10677
|
-
<li><code>--no-parallel</code> - By default, Nautobot splits test execution across multiple parallel subprocesses to reduce the runtime of the test suite. When troubleshooting obscure test exceptions, it may be desirable to disable that behavior temporarily using this parameter.</li>
|
|
10678
|
-
<li><code>--parallel-workers</code> - Explicitly specify the number of workers to use when running tests in parallel.</li>
|
|
10679
|
-
<li><code>--pattern</code> - Only run tests which match the given substring. Can be used multiple times.</li>
|
|
10680
|
-
<li><code>--no-reusedb</code> - Prevent reusing the initialized test database from a previous test run; instead, create a new database. <strong>The <code>--no-reusedb</code> option is mandatory if you're actively making changes to model migrations, or when switching between branches that differ in their included migrations.</strong></li>
|
|
10681
|
-
<li><code>--skip-docs-build</code> - Skip building/rebuilding the static Nautobot documentation before running the test. Saves some time on reruns when you haven't changed the documentation source files.</li>
|
|
10682
|
-
<li><code>--verbose</code> - Run tests more verbosely, including describing each test case as it is run.</li>
|
|
10683
|
-
</ul>
|
|
10684
|
-
<h5 id="unit-test-invocation-examples">Unit Test Invocation Examples<a class="headerlink" href="#unit-test-invocation-examples" title="Permanent link">¶</a></h5>
|
|
10685
|
-
<p>In general, when you first run the Nautobot tests in your local copy of the repository, we'd recommend:</p>
|
|
10686
|
-
<div class="highlight"><pre><span></span><code><a id="__codelineno-42-1" name="__codelineno-42-1" href="#__codelineno-42-1"></a>invoke unittest
|
|
10687
|
-
</code></pre></div>
|
|
10688
|
-
<p>When there are too many cores on the testing machine, you can limit the number of parallel workers:</p>
|
|
10689
|
-
<div class="highlight"><pre><span></span><code><a id="__codelineno-43-1" name="__codelineno-43-1" href="#__codelineno-43-1"></a>invoke unittest --parallel-workers 4
|
|
10690
|
-
</code></pre></div>
|
|
10691
|
-
<p>On subsequent reruns, you can add the other performance-related options:</p>
|
|
10692
|
-
<div class="highlight"><pre><span></span><code><a id="__codelineno-44-1" name="__codelineno-44-1" href="#__codelineno-44-1"></a>invoke unittest --skip-docs-build
|
|
10693
|
-
<a id="__codelineno-44-2" name="__codelineno-44-2" href="#__codelineno-44-2"></a>invoke unittest --skip-docs-build --label nautobot.core.tests
|
|
10694
|
-
</code></pre></div>
|
|
10695
|
-
<p>When switching between significantly different branches of the code base (e.g. <code>main</code> vs <code>develop</code> vs <code>next</code>), you'll need to for once include the <code>--no-keepdb</code> option so that the test database can be destroyed and recreated appropriately:</p>
|
|
10696
|
-
<div class="highlight"><pre><span></span><code><a id="__codelineno-45-1" name="__codelineno-45-1" href="#__codelineno-45-1"></a>invoke unittest --no-keepdb
|
|
10697
|
-
</code></pre></div>
|
|
10698
|
-
<p>To not use the cached test fixture, you will need to include the <code>--no-cache-test-fixtures</code> flag</p>
|
|
10699
|
-
<div class="highlight"><pre><span></span><code><a id="__codelineno-46-1" name="__codelineno-46-1" href="#__codelineno-46-1"></a>invoke unittest --no-cache-test-fixtures
|
|
10700
|
-
</code></pre></div>
|
|
10701
|
-
<p>To limit the test to a specific pattern or label, you can use the <code>--label</code> and <code>--pattern</code> options:</p>
|
|
10702
|
-
<div class="highlight"><pre><span></span><code><a id="__codelineno-47-1" name="__codelineno-47-1" href="#__codelineno-47-1"></a>invoke unittest --verbose --skip-docs-build --label nautobot.core.tests.dcim.test_views.DeviceTestCase
|
|
10703
|
-
<a id="__codelineno-47-2" name="__codelineno-47-2" href="#__codelineno-47-2"></a>invoke unittest --verbose --skip-docs-build --pattern Controller
|
|
10704
|
-
</code></pre></div>
|
|
10705
10684
|
<h4 id="integration-tests">Integration Tests<a class="headerlink" href="#integration-tests" title="Permanent link">¶</a></h4>
|
|
10706
10685
|
<p>Integration tests are automated tests written and run to ensure that the Nautobot application behaves as expected when being used as it would be in practice. By contrast to unit tests, where individual units of code are being tested, integration tests rely upon the server code actually running, and web UI clients or API clients to make real connections to the service to exercise actual workflows, such as navigating to the login page, filling out the username/passwords fields, and clicking the "Log In" button.</p>
|
|
10707
10686
|
<p>Running integrations tests requires the use of Docker at this time. They can be directly invoked using <code>nautobot-server test</code> just as unit tests can, however, a headless Firefox browser provided by Selenium is required. Because Selenium installation and setup is complicated, we have included a configuration for this to work out of the box using Docker.</p>
|
|
@@ -10721,11 +10700,7 @@
|
|
|
10721
10700
|
</tr>
|
|
10722
10701
|
</tbody>
|
|
10723
10702
|
</table>
|
|
10724
|
-
<p>Integration tests are run
|
|
10725
|
-
<details class="version-changed">
|
|
10726
|
-
<summary>Changed in version 2.0.0</summary>
|
|
10727
|
-
<p><code>SeleniumTestCase</code> was moved from the <code>nautobot.utilities.testing.integration</code> module to <code>nautobot.core.testing.integration</code>.</p>
|
|
10728
|
-
</details>
|
|
10703
|
+
<p>Integration tests are run by passing <code>--tag integration</code> to the <code>invoke tests</code> command. All other optional parameters to this command can be used the same as with unit tests.</p>
|
|
10729
10704
|
<table>
|
|
10730
10705
|
<thead>
|
|
10731
10706
|
<tr>
|
|
@@ -10735,22 +10710,14 @@
|
|
|
10735
10710
|
</thead>
|
|
10736
10711
|
<tbody>
|
|
10737
10712
|
<tr>
|
|
10738
|
-
<td><code>invoke integration
|
|
10713
|
+
<td><code>invoke tests --tag integration</code></td>
|
|
10739
10714
|
<td><code>nautobot-server --config=nautobot/core/tests/nautobot_config.py test --tag integration nautobot</code></td>
|
|
10740
10715
|
</tr>
|
|
10741
10716
|
</tbody>
|
|
10742
10717
|
</table>
|
|
10743
|
-
<div class="admonition info">
|
|
10744
|
-
<p class="admonition-title">Info</p>
|
|
10745
|
-
<p>The same arguments supported by <code>invoke unittest</code> are supported by <code>invoke integration-test</code>, with the exception of <code>--parallel</code> at this time. The key difference being the dependency upon the Selenium container, and inclusion of the <code>integration</code> tag.</p>
|
|
10746
|
-
</div>
|
|
10747
|
-
<div class="admonition tip">
|
|
10748
|
-
<p class="admonition-title">Tip</p>
|
|
10749
|
-
<p>You may also use <code>invoke integration-test</code> in the Virtual Environment workflow given that the <code>selenium</code> container is running, and that the <code>INVOKE_NAUTOBOT_LOCAL=True</code> environment variable has been set.</p>
|
|
10750
|
-
</div>
|
|
10751
10718
|
<div class="admonition tip">
|
|
10752
10719
|
<p class="admonition-title">Tip</p>
|
|
10753
|
-
<p>
|
|
10720
|
+
<p>You may also use <code>invoke tests --tag integration</code> in the Virtual Environment workflow given that the <code>selenium</code> container is running, and that the <code>INVOKE_NAUTOBOT_LOCAL=True</code> environment variable has been set.</p>
|
|
10754
10721
|
</div>
|
|
10755
10722
|
<h5 id="customizing-integration-test-executions">Customizing Integration Test Executions<a class="headerlink" href="#customizing-integration-test-executions" title="Permanent link">¶</a></h5>
|
|
10756
10723
|
<p>The following environment variables can be provided when running tests to customize where Nautobot looks for Selenium and where Selenium looks for Nautobot. If using the default setup documented above, there is no need to customize these.</p>
|
|
@@ -10758,6 +10725,10 @@
|
|
|
10758
10725
|
<li><code>NAUTOBOT_SELENIUM_URL</code> - The URL used by the Nautobot test runner to remotely control the headless Selenium Firefox node. You can provide your own, but it must be a <a href="https://selenium-python.readthedocs.io/getting-started.html#using-selenium-with-remote-webdriver"><code>Remote</code> WebDriver</a>. (Default: <code>http://localhost:4444/wd/hub</code>; for Docker: <code>http://selenium:4444/wd/hub</code>)</li>
|
|
10759
10726
|
<li><code>NAUTOBOT_SELENIUM_HOST</code> - The hostname used by the Selenium WebDriver to access Nautobot using Firefox. (Default: <code>host.docker.internal</code>; for Docker: <code>nautobot</code>)</li>
|
|
10760
10727
|
</ul>
|
|
10728
|
+
<h4 id="migration-tests">Migration Tests<a class="headerlink" href="#migration-tests" title="Permanent link">¶</a></h4>
|
|
10729
|
+
<p>Migration tests are automated tests of Nautobot database migrations, used to validate software upgrade (and rarely downgrade) scenarios. Because of their relatively slow performance, and because data migrations are rarely changed once initially written and validated, <em>migration tests do not run by default</em>, even in Nautobot's continuous integration (CI) environment, and <strong>must be run manually when relevant</strong>.</p>
|
|
10730
|
+
<p>Migration tests are run by passing <code>--tag migration_test</code> to the <code>invoke tests</code> command. All other optional parameters to this command can be used the same as with unit tests.</p>
|
|
10731
|
+
<p>See <a href="#handling-migrations">below</a> for more best practices when developing and testing migrations.</p>
|
|
10761
10732
|
<h3 id="verifying-the-rest-api-schema">Verifying the REST API Schema<a class="headerlink" href="#verifying-the-rest-api-schema" title="Permanent link">¶</a></h3>
|
|
10762
10733
|
<p>If you make changes to the REST API, you should verify that the REST API OpenAPI schema renders correctly without errors. To verify that there are no errors, you can run the <code>invoke check-schema</code> command (if using the Docker development environment) or the <code>nautobot-server spectacular</code> command. In the latter case you should run the command for each supported REST API version that Nautobot provides (e.g. "2.0", "2.1")</p>
|
|
10763
10734
|
<table>
|
|
@@ -10836,7 +10807,7 @@
|
|
|
10836
10807
|
<p>You’ll also want to run <code>invoke ruff --autoformat</code> (or <code>ruff format</code>) against the generated migration file as the autogenerated code doesn’t follow our style guide by default.</p>
|
|
10837
10808
|
<p>When modifying model field attributes, modify the test data in the tests too to reflect these changes and also any forms which refer to the model.</p>
|
|
10838
10809
|
<h4 id="testing-migrations">Testing Migrations<a class="headerlink" href="#testing-migrations" title="Permanent link">¶</a></h4>
|
|
10839
|
-
<p>Nautobot includes a number of data sets under the <code>development/datasets/</code> directory that represent various snapshots of historical database contents. You should validate whether your migrations correctly and successfully handle these datasets by running the <code>invoke migration-test --db-engine [postgres|mysql] --dataset development/datasets/<filename></code> command (which handles both the Docker Compose workflow as well as the Virtual Environment workflow).</p>
|
|
10810
|
+
<p>In addition to the automated <a href="#migration-tests">migration tests</a> described above, Nautobot includes a number of data sets under the <code>development/datasets/</code> directory that represent various snapshots of historical database contents. You should validate whether your migrations correctly and successfully handle these datasets by running the <code>invoke migration-test --db-engine [postgres|mysql] --dataset development/datasets/<filename></code> command (which handles both the Docker Compose workflow as well as the Virtual Environment workflow).</p>
|
|
10840
10811
|
<h2 id="working-on-documentation">Working on Documentation<a class="headerlink" href="#working-on-documentation" title="Permanent link">¶</a></h2>
|
|
10841
10812
|
<p>Some features require documentation updates or new documentation to be written. The documentation files can be found in the <code>docs</code> directory. To preview these changes locally, you can use <code>mkdocs</code>.</p>
|
|
10842
10813
|
<p>For substantial changes to the code (including new features, removal of existing features, or significant changes in behavior) you should always make corresponding documentation updates. Nautobot's documentation pipeline includes a custom plugin for <code>mkdocs</code> that adds a few useful macros for annotating such changes:</p>
|
|
@@ -9723,7 +9723,7 @@ To create the tag locally:</p>
|
|
|
9723
9723
|
<div class="highlight"><pre><span></span><code><a id="__codelineno-19-1" name="__codelineno-19-1" href="#__codelineno-19-1"></a>for ver in 3.9 3.10 3.11 3.12; do
|
|
9724
9724
|
<a id="__codelineno-19-2" name="__codelineno-19-2" href="#__codelineno-19-2"></a> export INVOKE_NAUTOBOT_PYTHON_VER=$ver
|
|
9725
9725
|
<a id="__codelineno-19-3" name="__codelineno-19-3" href="#__codelineno-19-3"></a> invoke stop
|
|
9726
|
-
<a id="__codelineno-19-4" name="__codelineno-19-4" href="#__codelineno-19-4"></a> invoke integration
|
|
9726
|
+
<a id="__codelineno-19-4" name="__codelineno-19-4" href="#__codelineno-19-4"></a> invoke tests --tag integration
|
|
9727
9727
|
<a id="__codelineno-19-5" name="__codelineno-19-5" href="#__codelineno-19-5"></a>done
|
|
9728
9728
|
</code></pre></div>
|
|
9729
9729
|
<p>Push the images to GitHub Container Registry and Docker Hub</p>
|
|
@@ -9436,7 +9436,7 @@
|
|
|
9436
9436
|
<a id="__codelineno-1-5" name="__codelineno-1-5" href="#__codelineno-1-5"></a>invoke pylint
|
|
9437
9437
|
</code></pre></div>
|
|
9438
9438
|
<p>or, as a single command:</p>
|
|
9439
|
-
<div class="highlight"><pre><span></span><code><a id="__codelineno-2-1" name="__codelineno-2-1" href="#__codelineno-2-1"></a>invoke
|
|
9439
|
+
<div class="highlight"><pre><span></span><code><a id="__codelineno-2-1" name="__codelineno-2-1" href="#__codelineno-2-1"></a>invoke lint
|
|
9440
9440
|
</code></pre></div>
|
|
9441
9441
|
<h2 id="introducing-new-dependencies">Introducing New Dependencies<a class="headerlink" href="#introducing-new-dependencies" title="Permanent link">¶</a></h2>
|
|
9442
9442
|
<p>The introduction of a new dependency is best avoided unless it is absolutely necessary. For small features, it's generally preferable to replicate functionality within the Nautobot code base rather than to introduce reliance on an external project. This reduces both the burden of tracking new releases and our exposure to outside bugs and attacks.</p>
|