Skip to content

Commit

Permalink
feat(#39): moved to pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
bensteUEM committed Jan 13, 2025
1 parent de3ed7b commit 78d6d00
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
runs-on: ubuntu-latest
environment: ev_kirche_baiersbronn
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4.2.2
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5.3.0
with:
python-version: '3.x'

Expand All @@ -37,8 +37,8 @@ jobs:
env:
POETRY_HOME: ${{ github.workspace }}/.poetry

- name: Run unittests
- name: Run Tests
run: |
python -m unittest tests.test_ChurchWebHelper
pytest tests/*
env:
POETRY_HOME: ${{ github.workspace }}/.poetry
13 changes: 4 additions & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
{
"python.testing.unittestArgs": [
"-v",
"-s",
"./tests",
"-p",
"test_*.py"
],
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": true,
"python.testing.defaultTestFramework": "pytest",
"python.testing.pytestEnabled": true,
"python.testing.pytestPath": "/tests",
"python.testing.unittestEnabled": false,
"githubPullRequests.ignoredPullRequestBranches": [
"master"
],
Expand Down
Empty file added tests/__init__.py
Empty file.
15 changes: 6 additions & 9 deletions tests/test_ChurchWebHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logging
import logging.config
import os
import unittest
import pytest
from pathlib import Path

from churchtools_api.churchtools_api import ChurchToolsApi
Expand All @@ -18,15 +18,14 @@
log_directory.mkdir(parents=True)
logging.config.dictConfig(config=logging_config)

class TestsChurchWebHelper(unittest.TestCase):
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
class TestsChurchWebHelper():
def setup_class(self, *args, **kwargs) -> None:

if "CT_TOKEN" in os.environ:
self.ct_token = os.environ["CT_TOKEN"]
self.ct_domain = os.environ["CT_DOMAIN"]
users_string = os.environ["CT_USERS"]
self.ct_users = ast.literal_eval(users_string)
#users_string = os.environ["CT_USERS"]
#self.ct_users = ast.literal_eval(users_string)
logger.info(
"using connection details provided with ENV variables")
else:
Expand All @@ -42,9 +41,7 @@ def __init__(self, *args, **kwargs) -> None:
self.api = ChurchToolsApi(
domain=self.ct_domain,
ct_token=self.ct_token)
logger.basicConfig(filename="logs/TestsChurchToolsApi.log", encoding="utf-8",
format="%(asctime)s %(name)-10s %(levelname)-8s %(message)s",
level=logger.DEBUG)

logger.info("Executing Tests RUN")

def tearDown(self)->None:
Expand Down

0 comments on commit 78d6d00

Please sign in to comment.