-
Notifications
You must be signed in to change notification settings - Fork 32
PyTest Migration #144
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
Draft
Victor-Jung
wants to merge
33
commits into
pulp-platform:devel
Choose a base branch
from
Victor-Jung:pr/pytest-migration
base: devel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
PyTest Migration #144
Changes from 10 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
48eb244
Add PyTest-base testing infra for generic platform
Victor-Jung f918ca2
Remove nvidia-pyindex install (not needed anymore)
Victor-Jung 77b3230
Add nvidia channel to the pip config instead of via nvidia-pyindex (d…
Victor-Jung d245a37
Update banshee.patch
Victor-Jung 05c020a
Fix patch
Victor-Jung ec5efd5
Update banshee patch
Victor-Jung 3760ced
Update CI docker
Victor-Jung b051153
Update generic platform CI to use PyTest
Victor-Jung eb6e31e
Lint and format
Victor-Jung 42c9cd7
Cleanup pytest.ini
Victor-Jung 89efc39
Apply Calin's comments
Victor-Jung 1929253
Refactor to better support multiple platforms and add cortexm to pyte…
Victor-Jung 393dd9d
Add PyTest suite for Siracusa and Siracusa Tiled
Victor-Jung 54f3e9c
Alpha version of CI suite using PyTest for Siracusa and Siracusa Tiled
Victor-Jung b2014b2
Add L2_DOUBLEBUFFER_MODELS to the pytest suite, add -s to debug slow …
Victor-Jung 5e1e63b
Fix typo
Victor-Jung b3789db
Make test use common build folder among a worker to improve compilati…
Victor-Jung f49f319
Cleanup unused runners and increase timeout for L3 models
Victor-Jung 262a64b
format and lint
Victor-Jung 70f1a19
Migrate Mempool tests to PyTest
Victor-Jung 694f4f9
Migrate Snitch, Chimera, and SoftHier tests to PyTest
Victor-Jung 432bfdf
Format and Lint
Victor-Jung ad13dcf
Migrate Snitch tiled tests to PyTest
Victor-Jung 9dc75df
Use the pytest suite in CI for CortexM platform
Victor-Jung d3f73d4
Add Siracusa Tiled with Neureka to the pytest suite
Victor-Jung 0f9b404
Format and lint
Victor-Jung 50d0010
Fix SoftHier test runner call
Victor-Jung 3f071a0
Format and lint
Victor-Jung e644108
Remove useless comments and add README for PyTest suite
Victor-Jung 91284fe
Cleanup GitHub action for siracusa with neureka
Victor-Jung 2ba9e44
Simplify siracusa tiled platform GitHub CI
Victor-Jung 03820f8
Remove unused testRunner
Victor-Jung 597a8a2
Update ccache generation to use PyTest suite
Victor-Jung File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,7 +34,7 @@ jobs: | |
| elif [[ "${{ github.ref_name }}" == "main" ]]; then | ||
| IMAGE="ghcr.io/pulp-platform/deeploy:main" | ||
| else | ||
| IMAGE="ghcr.io/pulp-platform/deeploy:devel" | ||
| IMAGE="ghcr.io/victor-jung/deeploy:pytest-migration" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's only draft, but don't forget this hard-coded path :) |
||
| fi | ||
| echo "image=${IMAGE}" >> "$GITHUB_OUTPUT" | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| # SPDX-FileCopyrightText: 2025 ETH Zurich and University of Bologna | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import os | ||
| from pathlib import Path | ||
|
|
||
| import coloredlogs | ||
| import pytest | ||
|
|
||
| from Deeploy.Logging import DEFAULT_FMT | ||
| from Deeploy.Logging import DEFAULT_LOGGER as log | ||
|
|
||
|
|
||
| def pytest_addoption(parser: pytest.Parser) -> None: | ||
| """Native PyTest hook: add custom command-line options for Deeploy tests.""" | ||
| parser.addoption( | ||
| "--skipgen", | ||
| action = "store_true", | ||
| default = False, | ||
| help = "Skip network generation step", | ||
| ) | ||
| parser.addoption( | ||
| "--skipsim", | ||
| action = "store_true", | ||
| default = False, | ||
| help = "Skip simulation step (only generate and build)", | ||
| ) | ||
| parser.addoption( | ||
| "--toolchain", | ||
| action = "store", | ||
| default = "LLVM", | ||
| help = "Compiler toolchain to use (LLVM or GCC)", | ||
| ) | ||
| parser.addoption( | ||
| "--toolchain-install-dir", | ||
| action = "store", | ||
| default = os.environ.get("LLVM_INSTALL_DIR"), | ||
| help = "Path to toolchain installation directory", | ||
| ) | ||
| parser.addoption( | ||
| "--cmake-args", | ||
| action = "append", | ||
| default = [], | ||
| help = "Additional CMake arguments (can be used multiple times)", | ||
| ) | ||
|
|
||
|
|
||
| def pytest_configure(config: pytest.Config) -> None: | ||
| """Native PyTest hook: configure pytest for Deeploy tests.""" | ||
| # Register custom markers | ||
| config.addinivalue_line("markers", "generic: mark test as a Generic platform test") | ||
| config.addinivalue_line("markers", "kernels: mark test as a kernel test (individual operators)") | ||
| config.addinivalue_line("markers", "models: mark test as a model test (full networks)") | ||
| config.addinivalue_line("markers", "slow: mark test as slow running") | ||
|
|
||
| # Configure logging based on verbosity | ||
| verbosity = config.option.verbose | ||
| if verbosity >= 3: | ||
| coloredlogs.install(level = 'DEBUG', logger = log, fmt = DEFAULT_FMT) | ||
| elif verbosity >= 2: | ||
| coloredlogs.install(level = 'INFO', logger = log, fmt = DEFAULT_FMT) | ||
| else: | ||
| coloredlogs.install(level = 'WARNING', logger = log, fmt = DEFAULT_FMT) | ||
|
|
||
|
|
||
| @pytest.fixture(scope = "session") | ||
| def deeploy_test_dir(): | ||
| """Return the DeeployTest directory path.""" | ||
| return Path(__file__).parent | ||
|
|
||
|
|
||
| @pytest.fixture(scope = "session") | ||
| def tests_dir(deeploy_test_dir): | ||
| """Return the Tests directory path.""" | ||
| return deeploy_test_dir / "Tests" | ||
|
|
||
|
|
||
| @pytest.fixture(scope = "session") | ||
| def toolchain_dir(request): | ||
| """Return the toolchain installation directory.""" | ||
| toolchain_install = request.config.getoption("--toolchain-install-dir") | ||
| if toolchain_install is None: | ||
| pytest.skip(reason = "LLVM_INSTALL_DIR not set") | ||
| return toolchain_install | ||
|
|
||
|
|
||
| @pytest.fixture(scope = "session") | ||
| def ccache_dir(): | ||
| """Setup and return ccache directory.""" | ||
| ccache_path = Path("/app/.ccache") | ||
| if ccache_path.exists(): | ||
| os.environ["CCACHE_DIR"] = str(ccache_path) | ||
| return ccache_path | ||
| return None | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def skipgen(request): | ||
| """Return whether to skip network generation.""" | ||
| return request.config.getoption("--skipgen") | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def skipsim(request): | ||
| """Return whether to skip simulation.""" | ||
| return request.config.getoption("--skipsim") | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def toolchain(request): | ||
| """Return the toolchain to use.""" | ||
| return request.config.getoption("--toolchain") | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def cmake_args(request): | ||
| """Return additional CMake arguments.""" | ||
| return request.config.getoption("--cmake-args") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # SPDX-FileCopyrightText: 2025 ETH Zurich and University of Bologna | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| [pytest] | ||
| # Pytest configuration for Deeploy tests | ||
|
|
||
| # Test discovery patterns | ||
| python_files = test_*.py | ||
| python_classes = Test* | ||
| python_functions = test_* | ||
|
|
||
| # Minimum version | ||
| minversion = 6.0 | ||
|
|
||
| # Add current directory to Python path | ||
| pythonpath = . | ||
|
|
||
| # Default options | ||
| addopts = | ||
| -ra | ||
| --strict-markers | ||
| --strict-config | ||
| --showlocals | ||
|
|
||
| # Test output | ||
| console_output_style = progress | ||
|
|
||
| # Logging | ||
| log_cli = false | ||
| log_cli_level = INFO | ||
| log_cli_format = %(levelname)s %(message)s | ||
|
|
||
| # Warnings | ||
| filterwarnings = | ||
| error | ||
| ignore::DeprecationWarning | ||
| ignore::PendingDeprecationWarning |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.