Skip to content

Commit

Permalink
test: rename imports in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Rizhiy committed Mar 2, 2024
1 parent 7d8172f commit a34c835
Show file tree
Hide file tree
Showing 13 changed files with 109 additions and 14 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Publish

on:
push:
branches: [master]

jobs:
publish:
if: contains(github.event.head_commit.message, 'Automatically generated by python-semantic-release')
concurrency: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
pip install --upgrade pip
pip install flit
- name: Publish with flit
env:
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.FLIT_PASSWORD }}
run: |-
flit publish
68 changes: 68 additions & 0 deletions .github/workflows/test_and_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
# This workflow will install Python dependencies, run tests
# Depending on commit messages it will update version and push new commit
name: Test and Version

on:
push:
branches: [master]
tags-ignore: [v*]
pull_request:
branches: [master]
tags-ignore: [v*]

jobs:
check-style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -e ".[dev]"
- name: Check style with ruff
run: |
ruff check .
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -e ".[test]"
- name: Test with pytest
run: |
pytest --cov pycs .
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: Rizhiy/replete
release:
if: ${{ github.ref == 'refs/heads/master' && !contains(github.event.head_commit.message, 'Automatically generated by python-semantic-release') }}
runs-on: ubuntu-latest
needs: [check-style, test]
concurrency: release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- name: Install dependencies
run: |
pip install --upgrade pip
pip install python-semantic-release
- name: Update version and push
run: |-
semantic-release version
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
*.egg-info
.DS_Store
dist
build
.coverage
__pycache__
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dynamic = ["description", "version"]
dependencies = ["coloredlogs", "docstring-parser", "python-dateutil", "xxhash"]

[project.optional-dependencies]
test = ["flaky", "pytest", "pytest-asyncio", "types-python-dateutil", "types-xxhash"]
test = ["flaky", "pytest", "pytest-asyncio", "pytest-coverage", "types-python-dateutil", "types-xxhash"]
dev = ["black", "replete[test]", "ruff"]

[tool.flit.sdist]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_aio.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import pytest

from nt_utils import LazyWrapAsync
from replete import LazyWrapAsync


@pytest.mark.asyncio()
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

import pytest

from nt_utils import autocli
from nt_utils.cli import AutoCLI
from replete import autocli
from replete.cli import AutoCLI

if TYPE_CHECKING:
from collections.abc import Generator, Sequence
Expand Down
2 changes: 1 addition & 1 deletion tests/test_consistent_hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pytest
import xxhash

from nt_utils import Timer, consistent_hash, grouped, picklehash
from replete import Timer, consistent_hash, grouped, picklehash

if TYPE_CHECKING:
from collections.abc import Callable, Iterable, Sequence
Expand Down
2 changes: 1 addition & 1 deletion tests/test_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import pytest

from nt_utils import ComparableEnum
from replete import ComparableEnum


class SomeEnum(ComparableEnum):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

import pytest

from nt_utils import assert_with_logging, setup_logging, warn_with_traceback
from nt_utils.logging import change_logging_level, offset_logger_level
from replete import assert_with_logging, setup_logging, warn_with_traceback
from replete.logging import change_logging_level, offset_logger_level


def test_warnings_traceback(capsys):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import pytest

from nt_utils import Register
from replete import Register


@pytest.fixture()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_timing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from flaky import flaky

from nt_utils import RateLimiter, Timer
from replete import RateLimiter, Timer

SLEEP_TIME = 0.001

Expand Down
4 changes: 2 additions & 2 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import pytest
from flaky import flaky

from nt_utils import Timer, ensure_unique_keys, split_list
from nt_utils.utils import futures_processing, weak_lru_cache
from replete import Timer, ensure_unique_keys, split_list
from replete.utils import futures_processing, weak_lru_cache


def test_unique_keys():
Expand Down
4 changes: 2 additions & 2 deletions tests/test_version.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import nt_utils
import replete


def test_version() -> None:
assert nt_utils.__version__
assert replete.__version__

0 comments on commit a34c835

Please sign in to comment.