diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..1dd10435 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,35 @@ +name: Build + +on: + push: + branches: [ "master", "release"] + paths: + - '.github/workflows/build.yml' + - 'src/**' + - 'Makefile' + pull_request: + branches: [ "master", "release"] + paths: + - '.github/workflows/build.yml' + - 'src/**' + - 'Makefile' + +jobs: + test_build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + + - name: Local build checking + run: | + pip install twine wheel + cd src/ && python setup.py sdist bdist_wheel diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml new file mode 100644 index 00000000..bfbc066f --- /dev/null +++ b/.github/workflows/install.yml @@ -0,0 +1,33 @@ +name: Installation + +on: + push: + branches: [ "master", "release"] + paths: + - '.github/workflows/install.yml' + - 'src/**' + - 'Makefile' + pull_request: + branches: [ "master", "release"] + paths: + - '.github/workflows/install.yml' + - 'src/**' + - 'Makefile' + +jobs: + install: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + + - name: PYPI install checking + run: pip install python-rucaptcha diff --git a/README.md b/README.md index 08f21120..89eef95f 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ [![Maintainability](https://api.codeclimate.com/v1/badges/aec93bb04a277cf0dde9/maintainability)](https://codeclimate.com/github/AndreiDrang/python-rucaptcha/maintainability) [![codecov](https://codecov.io/gh/AndreiDrang/python-rucaptcha/branch/master/graph/badge.svg?token=doybTUCfbD)](https://codecov.io/gh/AndreiDrang/python-rucaptcha) +[![Build](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/build.yml) +[![Installation](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/install.yml/badge.svg?branch=master)](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/install.yml) [![Tests](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/test.yml) [![Lint](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/lint.yml/badge.svg?branch=master)](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/lint.yml) @@ -44,6 +46,13 @@ git clone https://github.com/AndreiDrang/python-rucaptcha.git cd python-rucaptcha python setup.py install ``` + +## How to test? + +1. You need set ``API_KEY`` in your environment(get this value from you account). +2. Run command ``make tests``, from root directory. + + ### Changelog - v.5.1 - Check [releases page](https://github.com/AndreiDrang/python-rucaptcha/releases). diff --git a/src/python_rucaptcha/__version__.py b/src/python_rucaptcha/__version__.py index a1215079..07f3d477 100644 --- a/src/python_rucaptcha/__version__.py +++ b/src/python_rucaptcha/__version__.py @@ -1 +1 @@ -__version__ = "5.0.7a" +__version__ = "5.1" diff --git a/src/tests/test_core.py b/src/tests/test_core.py index 58b2a5da..c5a53510 100644 --- a/src/tests/test_core.py +++ b/src/tests/test_core.py @@ -36,6 +36,17 @@ async def test_aio_context_class_create(self): Failed tests """ + def test_context_err(self): + with pytest.raises(ValueError): + with BaseCaptcha(rucaptcha_key=self.RUCAPTCHA_KEY) as instance: + raise ValueError + + @pytest.mark.asyncio + async def test_aio_context_err(self): + with pytest.raises(ValueError): + async with BaseCaptcha(rucaptcha_key=self.RUCAPTCHA_KEY) as instance: + raise ValueError + @pytest.mark.parametrize("elements", [31, 33]) def test_context_failed_api_key(self, elements): with pytest.raises(ValueError):