Skip to content

Commit

Permalink
Merge pull request #1 from sb5m/addTest
Browse files Browse the repository at this point in the history
addTest merge
  • Loading branch information
sb5m committed Nov 7, 2023
2 parents 310c25c + 5138aef commit c69788c
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 1 deletion.
34 changes: 34 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python application

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test with pytest
run: |
pytest
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@
_ReSharper.*
*.resharper
Ankh.NoLoad
.vs
.vs

.venv
__pycache__
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cffi==1.16.0
clr-loader==0.2.6
pycparser==2.21
pythonnet==3.0.3
10 changes: 10 additions & 0 deletions tests/test_mainfunc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import subprocess
import pytest

def test_main_function():
script_path = "matrixCalcMain.py"
expected_output = "Enter the size of the matrix: "

result = subprocess.run(["python", script_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)

assert result.stdout == expected_output

0 comments on commit c69788c

Please sign in to comment.