From 2f0d5b353c2dcb4218e5263274ac9872b3ac9bbf Mon Sep 17 00:00:00 2001 From: Pryviet <62222839+barty5260@users.noreply.github.com> Date: Tue, 7 Nov 2023 22:50:43 +0100 Subject: [PATCH 1/3] added simple test --- .gitignore | 4 +++- .vscode/settings.json | 7 +++++++ tests/test_mainfunc.py | 10 ++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json create mode 100644 tests/test_mainfunc.py diff --git a/.gitignore b/.gitignore index e325cb9..a24fa6e 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,6 @@ _ReSharper.* *.resharper Ankh.NoLoad -.vs \ No newline at end of file +.vs + +__pycache__ \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..9b38853 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "python.testing.pytestArgs": [ + "tests" + ], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true +} \ No newline at end of file diff --git a/tests/test_mainfunc.py b/tests/test_mainfunc.py new file mode 100644 index 0000000..1316e6c --- /dev/null +++ b/tests/test_mainfunc.py @@ -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 From 37a9f1d315e260c3a3f0bc30b8e5488436f6bd74 Mon Sep 17 00:00:00 2001 From: Pryviet <62222839+barty5260@users.noreply.github.com> Date: Tue, 7 Nov 2023 22:54:28 +0100 Subject: [PATCH 2/3] added reqs --- .gitignore | 1 + requirements.txt | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore index a24fa6e..c28d7aa 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,5 @@ _ReSharper.* Ankh.NoLoad .vs +.venv __pycache__ \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..9377b80 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +cffi==1.16.0 +clr-loader==0.2.6 +pycparser==2.21 +pythonnet==3.0.3 From 5138aef26b19559c9cb7360a453fcb7beaa925d7 Mon Sep 17 00:00:00 2001 From: Pryviet <62222839+barty5260@users.noreply.github.com> Date: Tue, 7 Nov 2023 22:55:05 +0100 Subject: [PATCH 3/3] pipeline addition --- .github/workflows/python-app.yml | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/python-app.yml diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 0000000..3c21aa6 --- /dev/null +++ b/.github/workflows/python-app.yml @@ -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