Skip to content

Commit

Permalink
Adding py.test tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ktbyers committed Jun 4, 2024
1 parent e507906 commit f9b9d66
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/adding_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
name: "Linting and Tests"
on:
- push
- workflow_dispatch

jobs:
linting:
runs-on: "ubuntu-24.04"

steps:
# Checkout this repository
- uses: actions/checkout@v4

# Setup the specified Python version
- name: "Set up Python 3.12"
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r ./requirements.txt
- name: Linting (pylama)
run: pylama .

- name: Linting (black)
run: black --check .

pytest:
needs: linting
runs-on: "ubuntu-24.04"

steps:
# Checkout this repository
- uses: actions/checkout@v4

# Setup the specified Python version
- name: "Set up Python 3.12"
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r ./requirements.txt
- name: Execute Tests
run: py.test -s -v tests/
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ setuptools
rich==13.7.0
pylama==8.4.1
black==24.4.2
pytest==8.2.2
11 changes: 11 additions & 0 deletions tests/test_simple.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import os


def test_gh_actions():
running_in_gh = os.getenv("GITHUB_ACTIONS")
assert running_in_gh


def test_env_var():
my_env = os.getenv("ENVIRONMENT", "local")
assert my_env == "gh_actions"

0 comments on commit f9b9d66

Please sign in to comment.