Skip to content

Commit

Permalink
enable pytest logging (#81)
Browse files Browse the repository at this point in the history
* enable pytest logging

* show warning if test API key not found
  • Loading branch information
chadsr authored May 27, 2024
1 parent f023739 commit aca73d8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ line-length = 100
[tool.bandit]
exclude = ["test_*.py", "./venv/", "./env/", "./.env,tests"]

[tool.pytest.ini_options]
log_cli = true
log_cli_level = "INFO"
log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
log_cli_date_format = "%Y-%m-%d %H:%M:%S"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
6 changes: 6 additions & 0 deletions tests/test_waybar_crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import argparse
import pytest
from unittest import mock
import logging

from waybar_crypto import (
API_KEY_ENV,
Expand All @@ -18,8 +19,13 @@
read_config,
)

LOGGER = logging.getLogger(__name__)

TEST_API_KEY_ENV = "TEST_CMC_API_KEY"
API_KEY = os.getenv(TEST_API_KEY_ENV)
if API_KEY is None:
LOGGER.warning("No test API key provided. Skipping API tests")


TEST_CONFIG_PATH = "./config.ini.example"
TEST_API_KEY = "test_key"
Expand Down

0 comments on commit aca73d8

Please sign in to comment.