Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a4d8f18
Added some very basic integration testing support
raddessi Dec 29, 2020
9307060
Cleaned up a little
raddessi Dec 29, 2020
71b3bb9
Fixed fixture requirements
raddessi Dec 29, 2020
d6a1cae
Fixed another typo
raddessi Dec 29, 2020
e2511a5
Re-added the requests module import I mistakenly removed
raddessi Dec 29, 2020
7a5c398
Use safe_load to avoid warnings re: load()
Dec 30, 2020
bb25ebf
Added a few features
raddessi Jan 5, 2021
9817a5c
Silenced stdout messages on cleanup
raddessi Jan 5, 2021
c659eed
Added a little more documentation
raddessi Jan 5, 2021
4ab1f2a
First stab at a device type import
raddessi Jan 6, 2021
bffc707
Added faker package
raddessi Jan 6, 2021
0de9f18
Fixed some docs
raddessi Jan 6, 2021
3097a76
Added cleanup steps for docker networks and volumes
raddessi Jan 6, 2021
fe074cf
Fixed name collision with faker module
raddessi Jan 6, 2021
6dc84f2
Updated FIXME comment
raddessi Jan 6, 2021
e2e854a
Updated comments
raddessi Jan 6, 2021
a40a77c
Updated comments in tests
raddessi Jan 6, 2021
e09bfc6
Updated black version in gh workflow
raddessi Jan 6, 2021
8112544
Renamed gh workflow files to match upstream
raddessi Jan 6, 2021
a05ce6b
Merge branch 'master' into master.pytest-docker
raddessi Jan 6, 2021
25525c4
Fixed integration test
raddessi Jan 6, 2021
bd3358d
Removed a dead comment
raddessi Jan 6, 2021
93c6b19
Reverted accidental change to gh workflow
raddessi Jan 6, 2021
3a722d7
Reverted black version update, many files would be changed
raddessi Jan 6, 2021
fce6027
Multiple updates
raddessi Jan 7, 2021
f903af5
Merge branch 'master.pytest-docker' of https://github.com/raddessi/py…
raddessi Jan 7, 2021
3de7129
Blacked again with the matching version
raddessi Jan 7, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/py3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
python-version: ${{ matrix.python }}

- name: Install pynetbox and testing packages.
run: pip install . black==19.10b0 pytest
run: pip install . black==19.10b0 pytest pytest-docker faker

- name: Run Linter
run: black --diff --check pynetbox tests
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,8 @@ ENV/
/site

# mypy
.mypy_cache/
.mypy_cache/

# Other git repos checked out locally
.netbox-docker-*/
.devicetype-library/
43 changes: 43 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
from packaging import version


DEFAULT_NETBOX_VERSIONS = "2.7, 2.8, 2.9, 2.10"


def pytest_addoption(parser):
"""Hook on the pytest option parser setup.

Add some extra options to the parser.
"""
parser.addoption(
"--netbox-versions",
action="store",
default=DEFAULT_NETBOX_VERSIONS,
help=(
"The versions of netbox to run integration tests against, as a"
" comma-separated list. Default: %s" % DEFAULT_NETBOX_VERSIONS
),
)

parser.addoption(
"--no-cleanup",
dest="cleanup",
action="store_false",
help=(
"Skip any cleanup steps after the pytest session finishes. Any containers"
" created will be left running and the docker-compose files used to"
" create them will be left on disk."
),
)


def pytest_configure(config):
"""Hook that runs after test collection is completed.

Here we can modify items in the collected tests or parser args.
"""
# verify the netbox versions parse correctly and split them
config.option.netbox_versions = [
version.Version(version_string)
for version_string in config.option.netbox_versions.split(",")
]
Loading