Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: publish package on pypi

on:
release:
types: [ published ]

jobs:
build-and-publish-test:
name: Build and publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- uses: snok/install-poetry@v1.1.6
- name: Publish to test-pypi
run: |
poetry config repositories.test https://test.pypi.org/legacy/
poetry config pypi-token.test ${{ secrets.TEST_PYPI_TOKEN }}
poetry publish --build --no-interaction --repository test
build-and-publish:
needs: build-and-publish-test
name: Build and publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- uses: snok/install-poetry@v1.1.6
- name: Publish to pypi
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry publish --build --no-interaction
34 changes: 29 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,42 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ "3.6", "3.7", "3.8", "3.9" ]
python-version: [ "3.6", "3.7", "3.8", "3.9", ]
pytest-version: [ "5", "6" ]
steps:
- name: Check out repository
uses: actions/checkout@v2

- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Pytest ${{ matrix.pytest-version }}
run: pip install pytest==${{ matrix.pytest-version }}

- name: Install poetry
uses: snok/install-poetry@v1.1.6
with:
virtualenvs-in-project: true

- name: Load cached venv
uses: actions/cache@v2
id: cache-venv
with:
path: .venv
key: ${{ hashFiles('**/poetry.lock') }}-2

- name: Install dependencies
run: poetry install --no-interaction --no-root
if: steps.cache-venv.outputs.cache-hit != 'true'

- name: Install Pytest
run: |
source .venv/bin/activate
pip install pytest==${{ matrix.pytest-version }}

- name: Install package
run: pip install -e .
run: poetry install --no-interaction

- name: Run tests
run: pytest --verbose --assert=plain
run: |
source .venv/bin/activate
pytest --cov=src --verbose --assert=plain
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ repos:
'flake8-print',
'flake8-type-checking',
]
- repo: https://github.com/pycqa/isort
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

rev: 5.8.0
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.812'
hooks:
Expand Down
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

289 changes: 289 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

55 changes: 55 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,58 @@
[tool.poetry]
name = "pytest-split"
version = "0.2.1"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this updated? Manually?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah so when I update a package I would manually indent the version here and publish a release in the github repo 🙂

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if there's some way to get the version from git tags with poetry 🤔 But yeah, I can look into that later.

Copy link
Contributor Author

@sondrelg sondrelg Jun 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've not used it, but this popped up in my feed a few weeks back https://github.com/tiangolo/poetry-version-plugin

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to add this in a follow-up PR you'd just need to change the test and publish action to this as well, since it requires >= 1.2.0a1

      - name: Install poetry
        uses: snok/install-poetry@v1.1.6
        with:
          version: 1.2.0a1
          virtualenvs-in-project: true

description = "Pytest plugin for splitting test suite based on test execution time"
homepage = 'https://github.com/jerry-git/pytest-split'
repository = 'https://github.com/jerry-git/pytest-split'
authors = ["Jerry Pussinen <jerry.pussinen@gmail.com>"]
maintainers = []
readme = 'README.md'
keywords = ['pytest', 'plugin', 'split', 'tests']
packages = [{ include = 'src/pytest_split' }]
license = "MIT"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Framework :: Pytest",
"Typing :: Typed",
]

[tool.poetry.dependencies]
python = "^3.6"
pytest = "^5 | ^6"

[tool.poetry.dev-dependencies]
pytest-cov = "^2.12.1"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.plugins.pytest11]
pytest-split = "src.pytest_split.plugin"

[tool.black]
line-length = 120
include = '\.pyi?$'

[tool.coverage.run]
source = ["src/pytest_split/*"]
omit = []
branch = true

[tool.coverage.report]
show_missing = true
skip_covered = true
exclude_lines = [
'if TYPE_CHECKING:',
]

[tool.isort]
profile = 'black'
line_length = 120
38 changes: 0 additions & 38 deletions setup.py

This file was deleted.

3 changes: 0 additions & 3 deletions src/pytest_split/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
from ._version import version as __version__

__all__ = ("__version__",)
5 changes: 2 additions & 3 deletions src/pytest_split/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
from _pytest.reports import TestReport

if TYPE_CHECKING:
from typing import List, Tuple, Optional, Union
from typing import List, Optional, Tuple, Union

from _pytest import nodes

from _pytest.main import ExitCode
from _pytest.config import Config
from _pytest.config.argparsing import Parser
from _pytest.main import ExitCode

# Ugly hack for freezegun compatibility: https://github.com/spulec/freezegun/issues/286
STORE_DURATIONS_SETUP_AND_TEARDOWN_THRESHOLD = 60 * 10 # seconds
Expand Down
5 changes: 0 additions & 5 deletions tests/test_version.py

This file was deleted.