Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reformatted and added test runners #52

Merged
merged 2 commits into from
May 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/python-stylecheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Stylecheck

on:
push:
branches:
- main
- '[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+'
pull_request:

jobs:
stylecheck:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black
- name: run stylecheck
run: |
python -m black --check --diff .
33 changes: 33 additions & 0 deletions .github/workflows/python-unittests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Unittests

on:
push:
branches:
- master
- main
- '[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+'
pull_request:

jobs:
unittests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.10', '3.11']
os: [windows-latest, macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
- name: Test with unittest
run: python -m unittest discover -v -s tests
6 changes: 5 additions & 1 deletion src/amulet_editor/data/plugin/_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,11 @@ def _validate_import(imported_name: str, frame: FrameType):
# Plugins don't need to specify native python libraries.
pass
else:
package_name = packages_distributions()[imported_root_name][0].lower().replace("-", "_")
package_name = (
packages_distributions()[imported_root_name][0]
.lower()
.replace("-", "_")
)
if not any(
dependency.identifier == package_name
for dependency in plugin_container.data.depends.library
Expand Down
Loading