This directory contains the complete test suite for NK2DL, organized into different categories for various testing needs.
Always activate the NK2DL environment first:
# From the project root directory
.\.venv\Scripts\Activate-nk2dl.ps1Important: The environment activation script loads Nuke's Python interpreter, which is required for most tests.
# Run all pytest tests
python -m pytest tests/ -v
# Run with output visible (recommended for debugging)
python -m pytest tests/ -v -sPurpose: Core functionality testing using pytest framework
Requirements: Nuke Python environment
# Run all pytest tests
python -m pytest tests/pytest/ -v -s
# Run specific test files
python -m pytest tests/pytest/pytest_config.py -v -s
python -m pytest tests/pytest/pytest_submission.py -v -s
python -m pytest tests/pytest/pytest_deadline_connection.py -v -s
# Run specific test patterns
python -m pytest tests/pytest/ -v -s -k "config"
python -m pytest tests/pytest/ -v -s -k "mock"
python -m pytest tests/pytest/ -v -s -k "real"Key files:
conftest.py- Test configuration, fixtures, and Nuke environment detectionpytest_submission.py- Submission engine tests (mock and real modes)pytest_config.py- Configuration system testspytest_deadline_connection.py- Deadline connection testspytest_cli.py- Command-line interface tests
Purpose: Qt/PySide interface testing
Requirements: Nuke Python environment
# Standalone Qt tests
python tests/qt/test_qt_app.py
# Nuke-integrated GUI tests
nuke --tg tests/qt/test_main_panel_nuke.py
nuke --tg tests/qt/test_qt_app_nuke.py
# Logic-only tests (no UI)
python tests/qt/test_inheritance_logic.py📖 See qt/README.md for detailed GUI testing documentation
Purpose: Test Nuke scripts for integration testing
Files:
test_dependencies.nk- Dependency handling testtest_multishot.nk- Multi-shot rendering testpytest_nukescript.nk- Script for pytest integration
# Use these scripts with the main integration tests
python tests/test_nk2dl.pyPurpose: End-to-end submission testing
python tests/test_nk2dl.pyPurpose: Deadline connectivity and communication
python tests/test_deadline_connection.pyPurpose: Examples and tests for pre/post-build job scripts
# These are typically called by the submission system
# Can be tested standalone:
python tests/pre_build_test.py
python tests/post_build_test.pyFast, isolated tests for individual components:
python -m pytest tests/pytest/pytest_config.py -v
python -m pytest tests/pytest/pytest_cli.py -vEnd-to-end workflow testing:
python tests/test_nk2dl.py
python -m pytest tests/pytest/pytest_submission.py -v -sInterface and user interaction testing:
python tests/qt/test_qt_app.py
nuke --tg tests/qt/test_main_panel_nuke.pyExternal service connectivity:
python tests/test_deadline_connection.py
python -m pytest tests/pytest/pytest_deadline_connection.py -v -sTests using mocked dependencies (faster, no external dependencies):
python -m pytest tests/pytest/pytest_submission.py -v -s -k "mock"Tests using actual Deadline connections (requires Deadline setup):
python -m pytest tests/pytest/pytest_submission.py -v -s -k "real"Before running tests, verify your environment:
python -m pytest tests/pytest/pytest_submission.py::test_000_environment_check -v -sLocated at tests/pytest.ini:
[pytest]
testpaths = .
python_files = pytest_*.py test_*.py
addopts = -v
markers = real_only: marks tests that should only run in real modereal_only- Tests that require real Deadline connection
Solution: Activate the NK2DL environment first:
.\.venv\Scripts\Activate-nk2dl.ps1Expected: Some config tests may fail due to your personal config file overriding test values. This indicates the config system is working correctly.
- Check if Deadline is running and accessible
- Verify your config in
~/.nuke/nk2dl/config.yaml - Run connection tests separately:
python tests/test_deadline_connection.pyFor Nuke GUI tests, ensure you're using terminal GUI mode:
nuke --tg tests/qt/test_main_panel_nuke.pyEnsure you're running from the project root directory:
cd /path/to/nk2dl-modules/nk2dl
.\.venv\Scripts\Activate-nk2dl.ps1- Unit tests: Add to
tests/pytest/withpytest_ortest_prefix - GUI tests: Add to
tests/qt/and update qt/README.md - Integration tests: Add to root
tests/directory
- Use the environment activation script for Nuke dependencies
- Follow PEP8 coding standards
- Add docstrings explaining test purpose
- Use meaningful test names
- Add markers for special test categories
# Watch mode (re-run on file changes) - requires pytest-watch
ptw tests/pytest/pytest_config.py -- -v -s
# Coverage reporting - requires pytest-cov
python -m pytest tests/pytest/ --cov=nk2dl --cov-report=html
# Profile slow tests - requires pytest-profiling
python -m pytest tests/pytest/ --profileNK2DL submission tests support two modes:
- Uses mocked Deadline connections
- Does NOT submit jobs to the farm
- Fast execution, no external dependencies
- Ideal for development and CI/CD
# Run only mock tests
python -m pytest tests/pytest/pytest_submission.py -k "mock" -v -s
# Mock mode is used automatically when both modes are run
python -m pytest tests/pytest/pytest_submission.py -v -s- Connects to actual Deadline farm
- DOES submit real jobs to Deadline
- Requires working Deadline connection
- Use with caution on production farms
# Run only real tests (submits actual jobs!)
python -m pytest tests/pytest/pytest_submission.py -k "real" -v -s
# Run specific real test
python -m pytest tests/pytest/pytest_submission.py::test_submit_job[real] -v -sThese tests are designed to run in automated environments:
# Minimal test run (no GUI, mock mode only)
python -m pytest tests/pytest/ -v -k "not real_only and not gui"
# Full test suite (requires Nuke and Deadline)
.\.venv\Scripts\Activate-nk2dl.ps1
python -m pytest tests/ -v📖 Additional Documentation:
- Qt Tests Guide - Detailed GUI testing
- Configuration Guide - Test configuration
- Troubleshooting Guide - Common issues