-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
1,958 additions
and
24 deletions.
There are no files selected for viewing
This file contains 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,28 @@ | ||
name: Test h3daemon | ||
|
||
on: | ||
push: | ||
branches: | ||
- "**" | ||
paths: | ||
- h3daemon/** | ||
- .github/workflows/test-h3daemon.yml | ||
|
||
defaults: | ||
run: | ||
working-directory: h3daemon | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Run tests | ||
run: | | ||
pipx run poetry install | ||
pipx run poetry run pytest -n 30 |
This file contains 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 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,35 @@ | ||
import os | ||
import traceback | ||
|
||
__all__ = ["debug_exception", "debug_message"] | ||
|
||
_should_debug: bool | None = None | ||
_debug_file: str | None = None | ||
|
||
|
||
def should_debug(): | ||
global _should_debug | ||
if _should_debug is None: | ||
_should_debug = bool(os.environ.get("H3DAEMON_DEBUG", 0)) | ||
return _should_debug | ||
|
||
|
||
def debug_file(): | ||
global _debug_file | ||
if _debug_file is None: | ||
_debug_file = os.environ.get("H3DAEMON_DEBUG_FILE", "h3daemon_debug.txt") | ||
return _debug_file | ||
|
||
|
||
def debug_exception(exception: Exception): | ||
if should_debug(): | ||
with open(debug_file(), "a") as f: | ||
f.write(f"{type(exception)}\n") | ||
f.write(f"{exception.args}\n") | ||
f.write(traceback.format_exc()) | ||
|
||
|
||
def debug_message(msg: str): | ||
if should_debug(): | ||
with open(debug_file(), "a") as f: | ||
f.write(f"{msg}\n") |
This file contains 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 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 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 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,8 @@ | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture | ||
def files_path() -> Path: | ||
return Path(__file__).parent / "files" |
Oops, something went wrong.