diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..7e5aedc --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,41 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python package + +on: + push: + branches: [ "master", "development" ] + pull_request: + branches: [ "master", "development" ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -r requirements-dev.txt + python -m pip install . + - 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 + - name: Test with pytest + env: + TOKEN: ${{ secrets.TOKEN }} + BASE_URL: ${{ secrets.BASE_URL }} + run: | + pytest \ No newline at end of file diff --git a/tests/test_async.py b/tests/test_async.py index fad05aa..9519275 100644 --- a/tests/test_async.py +++ b/tests/test_async.py @@ -19,9 +19,9 @@ class TestAsyncClient(unittest.IsolatedAsyncioTestCase): async def asyncSetUp(self): session = aiohttp.ClientSession(trust_env=True) self.client = brawlstats.Client( - token=os.getenv('token'), + token=os.getenv('TOKEN'), session=session, - base_url=os.getenv('base_url'), + base_url=os.getenv('BASE_URL'), is_async=True ) diff --git a/tests/test_blocking.py b/tests/test_blocking.py index 76cb8f9..d5b16c1 100644 --- a/tests/test_blocking.py +++ b/tests/test_blocking.py @@ -14,8 +14,8 @@ class TestBlockingClient(unittest.TestCase): def setUp(self): self.client = brawlstats.Client( - token=os.getenv('token'), - base_url=os.getenv('base_url') + token=os.getenv('TOKEN'), + base_url=os.getenv('BASE_URL') ) def tearDown(self): diff --git a/tox.ini b/tox.ini index 2399253..a179fd4 100644 --- a/tox.ini +++ b/tox.ini @@ -6,15 +6,11 @@ ignore = E252,E302,E731,W605 [tox] envlist = py39, py310, py311, py312 -[pytest] -filterwarnings = - ignore:"@coroutine" decorator is deprecated since Python 3.8, use "async def" instead:DeprecationWarning - [testenv] deps = -Ur{toxinidir}/requirements-dev.txt commands = flake8 . pytest passenv = - token - base_url \ No newline at end of file + TOKEN + BASE_URL \ No newline at end of file