supervisor/tests/common.py
dependabot[bot] a85e816cd7
Bump pylint from 2.10.2 to 2.11.1 (#3128)
* Bump pylint from 2.10.2 to 2.11.1

Bumps [pylint](https://github.com/PyCQA/pylint) from 2.10.2 to 2.11.1.
- [Release notes](https://github.com/PyCQA/pylint/releases)
- [Changelog](https://github.com/PyCQA/pylint/blob/main/ChangeLog)
- [Commits](https://github.com/PyCQA/pylint/compare/v2.10.2...v2.11.1)

---
updated-dependencies:
- dependency-name: pylint
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix linter issues

* fix tests lint

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Pascal Vizeli <pvizeli@syshack.ch>
2021-09-22 14:33:32 +02:00

22 lines
630 B
Python

"""Common test functions."""
import json
from pathlib import Path
def load_json_fixture(filename: str) -> dict:
"""Load a json fixture."""
path = Path(Path(__file__).parent.joinpath("fixtures"), filename)
return json.loads(path.read_text(encoding="utf-8"))
def load_fixture(filename: str) -> str:
"""Load a fixture."""
path = Path(Path(__file__).parent.joinpath("fixtures"), filename)
return path.read_text(encoding="utf-8")
def exists_fixture(filename: str) -> bool:
"""Check if a fixture exists."""
path = Path(Path(__file__).parent.joinpath("fixtures"), filename)
return path.exists()