Skip to content

Commit

Permalink
Merge pull request #2 from IdoKendo/0.1.3
Browse files Browse the repository at this point in the history
v0.1.3
  • Loading branch information
IdoKendo authored Aug 2, 2022
2 parents 640d1d6 + f0b56ef commit 3d89c79
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 27 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.9", "3.10"]

steps:
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@

2022-08-02
==========

Added
-----

- Run tox on windows in GH actions.

Changed
-------

- Using pytest-cov instead of bare coverage.
- Lowered minimum python version to 3.8

2022-07-31
==========

Expand Down
26 changes: 24 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
[tool.poetry]
name = "mysql-context-manager"
version = "0.1.2"
version = "0.1.3"
description = "Work with MySQL databases asynchronously, and in context."
license = "MIT"
authors = ["IdoKendo <ryuusuke@gmail.com>"]
readme = "README.md"
homepage = "https://pypi.org/project/mysql-context-manager/"
repository = "https://github.com/IdoKendo/mysql-context-manager"

[tool.poetry.dependencies]
python = "^3.9"
python = "^3.8"
databases = "^0.6.0"
PyMySQL = "^1.0.2"
aiomysql = "^0.1.1"
Expand All @@ -16,9 +19,15 @@ pytest = "7.1.2"
pre-commit = "^2.20.0"
scriv = {extras = ["toml"], version = "^0.16.0"}
tox = "^3.25.1"
coverage = "^6.4.2"
pytest-asyncio = "^0.19.0"
pytest-mock = "^3.8.2"
pytest-cov = "^3.0.0"

[tool.pytest.ini_options]
addopts = "--cov=mysql_context_manager --cov-report xml"
testpaths = [
"tests",
]

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
2 changes: 1 addition & 1 deletion src/mysql_context_manager/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# pylint: disable=C0114,C0115,R0913
from __future__ import annotations

__version__ = "0.1.2"
__version__ = "0.1.3"

import json
from json import JSONDecodeError
Expand Down
14 changes: 14 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import pytest


@pytest.fixture()
def mock_db(mocker):
mocker.patch("databases.Database.connect", return_value=None)
mocker.patch("databases.Database.disconnect", return_value=None)
mocker.patch(
"databases.Database.fetch_all",
return_value=[
[("username", "Aang")],
],
)
mocker.patch("databases.Database.execute", return_value=None)
15 changes: 1 addition & 14 deletions tests/test_mysql_context_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,8 @@
from mysql_context_manager import MysqlConnector


@pytest.fixture()
def mock_db(mocker):
mocker.patch("databases.Database.connect", return_value=None)
mocker.patch("databases.Database.disconnect", return_value=None)
mocker.patch(
"databases.Database.fetch_all",
return_value=[
[("username", "Aang")],
],
)
mocker.patch("databases.Database.execute", return_value=None)


def test_version():
assert __version__ == "0.1.2"
assert __version__ == "0.1.3"


def test_connection_string():
Expand Down
11 changes: 5 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
[tox]
isolated_build = True
envlist = py39,py310
envlist = py38,py39,py310

[testenv]
passenv = USERNAME
deps =
black
flake8
pylint
coverage
pytest
pytest-asyncio
pytest-mock
pytest-cov
commands =
black --line-length=120 --check src/
flake8 --max-line-length=120 src/
pylint src/
pytest .
coverage run --source=src/ --branch -m pytest .
coverage report -m
coverage xml
pytest

[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310

0 comments on commit 3d89c79

Please sign in to comment.