diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..7699178 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,31 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Python Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..bbcbbe7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..b48a61c --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,38 @@ +name: Pre-commit + +on: + pull_request: + branches: [main] + +concurrency: + group: "lint" # Concurrency group named "lint" + cancel-in-progress: false + +jobs: + pre-commit: + name: Pre-Commit + runs-on: ubuntu-latest # Run the job on the latest version of Ubuntu + + steps: + - name: Checkout + uses: actions/checkout@v4 # Checkout the repository code + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" # Set up Python version 3.11 for the job + + # Install Portaudio on Ubuntu + - name: Installing Portaudio in Ubuntu + run: sudo apt-get install portaudio19-dev python-all-dev + + - name: Install Poetry Package + working-directory: 01OS # Set the working directory to "01OS" + run: | + pip install --upgrade pip + pip install poetry==1.3.2 + poetry config virtualenvs.create false + poetry install --no-interaction --with dev + + - name: Run Pre-commit + run: pre-commit run --all-files diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..2d6b051 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,61 @@ +name: Run Test + +on: + pull_request: + branches: [main] + # push: # Trigger the workflow on push events + +concurrency: + group: "test" + cancel-in-progress: false + +jobs: + pytest: + name: Run Test + + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + python-version: ["3.11"] + + defaults: + run: + working-directory: 01OS + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install poetry + run: pipx install poetry + + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: "poetry" + + # Install Portaudio on Ubuntu + - name: Installing Portaudio in Ubuntu + if: matrix.os == 'ubuntu-latest' + run: sudo apt-get install portaudio19-dev python-all-dev + + # Install Portaudio on macOS using Homebrew + - name: Installing Portaudio in Mac + if: matrix.os == 'macos-latest' + run: brew install portaudio + + # Install Poetry and project dependencies + - name: Install Poetry Package + run: | + pip install --upgrade pip + pip install poetry==1.3.2 + poetry config virtualenvs.create false + poetry install --no-interaction --with dev + + # Run pytest + - name: Run Pytest + run: poetry run pytest tests diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..6d514b2 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,26 @@ +repos: +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: "v0.2.2" + hooks: + - id: ruff + args: ["--fix"] + - id: ruff-format +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: fix-encoding-pragma + args: [--remove] + - id: check-yaml + - id: debug-statements + language_version: python3 +- repo: local + hooks: + - id: pytest + name: pytest + entry: pytest 01OS/tests + language: system + types: [python] + pass_filenames: false + always_run: true diff --git a/01OS/poetry.lock b/01OS/poetry.lock index e29c468..748742c 100644 --- a/01OS/poetry.lock +++ b/01OS/poetry.lock @@ -1667,6 +1667,17 @@ zipp = {version = ">=3.1.0", markers = "python_version < \"3.10\""} docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-lint"] testing = ["jaraco.collections", "pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy", "pytest-ruff (>=0.2.1)", "zipp (>=3.17)"] +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + [[package]] name = "inquirer" version = "3.2.4" @@ -3291,6 +3302,21 @@ files = [ docs = ["furo (>=2023.9.10)", "proselint (>=0.13)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.25.2)"] test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)"] +[[package]] +name = "pluggy" +version = "1.4.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pluggy-1.4.0-py3-none-any.whl", hash = "sha256:7db9f7b503d67d1c5b95f59773ebb58a8c1c288129a88665838012cfb07b8981"}, + {file = "pluggy-1.4.0.tar.gz", hash = "sha256:8c85c2876142a764e5b7548e7d9a0e0ddb46f5185161049a79b7e974454223be"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + [[package]] name = "plyer" version = "2.1.0" @@ -6617,6 +6643,28 @@ files = [ packaging = ">=21.3" Pillow = ">=8.0.0" +[[package]] +name = "pytest" +version = "8.1.1" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pytest-8.1.1-py3-none-any.whl", hash = "sha256:2a8386cfc11fa9d2c50ee7b2a57e7d898ef90470a7a34c4b949ff59662bb78b7"}, + {file = "pytest-8.1.1.tar.gz", hash = "sha256:ac978141a75948948817d360297b7aae0fcb9d6ff6bc9ec6d514b85d5a65c044"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=1.4,<2.0" +tomli = {version = ">=1", markers = "python_version < \"3.11\""} + +[package.extras] +testing = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + [[package]] name = "python-dateutil" version = "2.9.0.post0" @@ -8417,4 +8465,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.12" -content-hash = "6aa948d6a556517941cd0f399e509be40e273665886b5e2cd6479884a91076ad" +content-hash = "8be29df37abd9cbe801a8ef165d05db22311f58a6119d5676d8d6a706e155a1a" diff --git a/01OS/pyproject.toml b/01OS/pyproject.toml index 593f1b9..2ba825b 100644 --- a/01OS/pyproject.toml +++ b/01OS/pyproject.toml @@ -41,6 +41,7 @@ build-backend = "poetry.core.masonry.api" black = "^23.10.1" isort = "^5.12.0" pre-commit = "^3.6.2" +pytest = "^8.1.1" [tool.black] target-version = ['py311'] diff --git a/01OS/tests/__init__.py b/01OS/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/01OS/tests/sample_test.py b/01OS/tests/sample_test.py new file mode 100644 index 0000000..0cd45d5 --- /dev/null +++ b/01OS/tests/sample_test.py @@ -0,0 +1,7 @@ +def hello_world(): + return "Hello, World!" + + +# A test function to assert that hello_world() returns the expected string +def test_hello_world(): + assert hello_world() == "Hello, World!"