Skip to content

Commit

Permalink
working github tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KingKDot committed Mar 24, 2024
1 parent 64c4cab commit ac3405d
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 3 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 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" ]

permissions:
contents: read

jobs:
build:

runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12.2
uses: actions/setup-python@v3
with:
python-version: "3.12.2"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install -r requirements.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
10 changes: 7 additions & 3 deletions test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def check_output(self, file_path, new_file_path, hide_stuff, *args, **kwargs):
Returns:
- None
"""

subprocess.Popen(
f"python {python_file} -f {file_path}",
shell=True,
Expand Down Expand Up @@ -200,11 +201,11 @@ def remove_all_obf_files(self, *args, **kwargs) -> None:
"""
for file in glob.glob(f"{directory}\\tests_full\\*.bat"):
if file.endswith("_obf.bat"):
print(file)
# print(file)
os.remove(file)
for file in glob.glob(f"{directory}\\tests_full\\*.txt"):
if file.endswith(".bat.txt"):
print(file)
# print(file)
os.remove(file)
return

Expand Down Expand Up @@ -245,9 +246,11 @@ def env_var_test():
}

users_env_vars = os.environ.copy()
# replace the current PATHEXT with the one we need due to issues with pytest
users_env_vars["PATHEXT"] = GOOD_ENV_VARS["PATHEXT"]
for env_var, value in GOOD_ENV_VARS.items():
if users_env_vars[env_var] != value:
print(f"{env_var} is not set correctly")
print(f"{env_var} is not set correctly", users_env_vars[env_var])
return False
return True

Expand Down Expand Up @@ -294,4 +297,5 @@ def test_mult_inter():
print("Failed")
else:
print("Passed")
new.remove_all_obf_files()
print(timeit.default_timer() - start_time)

0 comments on commit ac3405d

Please sign in to comment.