Skip to content

Commit

Permalink
Merge pull request #139 from AndreiDrang/master
Browse files Browse the repository at this point in the history
5.1
  • Loading branch information
AndreiDrang committed Mar 15, 2023
2 parents 7a96ff1 + b750c65 commit d17b7b9
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 1 deletion.
35 changes: 35 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
33 changes: 33 additions & 0 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion src/python_rucaptcha/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "5.0.7a"
__version__ = "5.1"
11 changes: 11 additions & 0 deletions src/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit d17b7b9

Please sign in to comment.