Skip to content

Commit

Permalink
Make some basic test to pass the ci/cd
Browse files Browse the repository at this point in the history
  • Loading branch information
SoulRaven committed Jun 10, 2024
1 parent 5cd52e6 commit cafcff2
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-

# A Python "namespace package" http://www.python.org/dev/peps/pep-0382/
# This always goes inside a namespace package's __init__.py

from pkgutil import extend_path

__path__ = extend_path(__path__, __name__)
39 changes: 39 additions & 0 deletions tests/test_basic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
import os
import pytest

from pathlib import Path


def file_contains_text(file: Path, text: str) -> bool:
return open(file, "r").read().find(text) != -1


@pytest.fixture(scope="module")
def script_loc(request):
"""Return the directory of the currently running test script
:param request:
:return:
"""

return Path(request.fspath).parent.parent


def test_cicd(script_loc):
assert file_contains_text(
script_loc.joinpath("Makefile"), "build-and-publish"
), "From the Makefile is missing the build-and-publish command"


def test_tox(script_loc):
"""
:param script_loc:
:return:
"""
assert file_contains_text(
script_loc.joinpath(".github/workflows/push_to_main.yml"),
"poetry add tox-gh-actions",
)
assert os.path.isfile(script_loc.joinpath("tox.ini"))

0 comments on commit cafcff2

Please sign in to comment.