Skip to content

Commit

Permalink
Merge pull request #5 from cloudsteak/test
Browse files Browse the repository at this point in the history
Unit teszt
  • Loading branch information
the1bit authored Apr 29, 2024
2 parents 28c5567 + fb0ad5e commit 7e8fbd0
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 2 deletions.
30 changes: 28 additions & 2 deletions .github/workflows/Kod4.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,41 @@ on:
- "Kod4/**"
pull_request:
branches:
- release-*
- "*"
paths:
- "Kod4/**"

env:
APP_NAME: python-streamlit-webapp # Alkalmazás képfájl neve

jobs:
build:
test:
name: Tesztelés (CI)
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest

steps:
- name: Kód letöltése
uses: actions/checkout@v4
- name: Python beállítása
uses: actions/setup-python@v4
with:
python-version: '3.11'
architecture: 'x64'
- name: Python verzió megjelenítése
run: python -c "import sys; print(sys.version)"
- name: Python csomagok telepítése
run: |
cd Kod4
pip install -r requirements.txt
- name: Alkalmazás tesztelés
run: |
cd Kod4
pytest
deploy:
name: Telepítés (CD)
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest

steps:
Expand Down
9 changes: 9 additions & 0 deletions Kod4/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import numpy as np
import time

# Session state
st.session_state.szamlalo = st.session_state.get("szamlalo", 0)

# Cím
st.title("Mentor Klub - Docker alapú alkalmazások Cloud-ban")
# Szöveg, amely formázva van
Expand All @@ -13,6 +16,12 @@
# """
)

# Számláló
ertek = st.number_input("", 0, 10)
if st.button("+1"):
st.session_state.szamlalo += ertek
st.markdown(f"Számláló: {st.session_state.szamlalo}")

# Csúszka
window = st.slider("Mennyire van jó kedved ma?", 1, 10, 7)
# Csúszka aktuális értéke
Expand Down
3 changes: 3 additions & 0 deletions Kod4/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ click==8.1.7
gitdb==4.0.11
GitPython==3.1.43
idna==3.7
iniconfig==2.0.0
Jinja2==3.1.3
jsonschema==4.21.1
jsonschema-specifications==2023.12.1
Expand All @@ -18,10 +19,12 @@ numpy==1.26.4
packaging==24.0
pandas==2.2.2
pillow==10.3.0
pluggy==1.5.0
protobuf==4.25.3
pyarrow==16.0.0
pydeck==0.9.0b1
Pygments==2.17.2
pytest==8.2.0
python-dateutil==2.9.0.post0
pytz==2024.1
referencing==0.35.0
Expand Down
8 changes: 8 additions & 0 deletions Kod4/test_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from streamlit.testing.v1 import AppTest

def test_increment_and_add():
"""Számláló tesztelése."""
at = AppTest.from_file("app.py").run()
at.number_input[0].increment().run()
at.button[0].click().run()
assert at.markdown[1].value == "Számláló: 1"

0 comments on commit 7e8fbd0

Please sign in to comment.