From 4c61d993c84214dca93434559b05c32523a64db7 Mon Sep 17 00:00:00 2001 From: Joshua Date: Fri, 11 Aug 2023 10:13:05 -0500 Subject: [PATCH 1/4] Add release automation --- .github/workflows/release.yaml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..d3115a6 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,34 @@ +name: Release Package + +on: [workflow_dispatch] + +permissions: + contents: read + +jobs: + build_package: + name: Build Package + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Build sdist and wheel + run: pipx run build --sdist --wheel + - uses: actions/upload-artifact@v3 + with: + path: dist + + pypi-publish: + needs: [build_package] + name: Upload release to PyPI + runs-on: ubuntu-latest + environment: + name: pypi + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v3 + with: + name: artifact + path: dist + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 From b46f4e3785e87a1b15514bb2abd779d430bed7fe Mon Sep 17 00:00:00 2001 From: Harry Date: Wed, 30 Aug 2023 12:52:43 +0100 Subject: [PATCH 2/4] try to bring some consistency to terminal-width tests --- tests/test_pytest_icdiff.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_pytest_icdiff.py b/tests/test_pytest_icdiff.py index be5a5e1..d0645af 100644 --- a/tests/test_pytest_icdiff.py +++ b/tests/test_pytest_icdiff.py @@ -1,4 +1,6 @@ import icdiff +from unittest import mock +import pytest import re from pprintpp import pformat @@ -7,6 +9,13 @@ GREEN_ON = '\x1b[1;32m' ANSI_ESCAPE_RE = re.compile(r'(\x9B|\x1B\[)[0-?]*[ -/]*[@-~]') +@pytest.fixture +def with_80_col_terminal(): + # haven't found a better way to simulate terminal sizes + # at a lower level yet sadly. + with mock.patch("pytest_icdiff.COLS", 99): + yield + def test_short_dict(testdir): one = { @@ -193,6 +202,7 @@ def test_a(): assert drilldown_expression in output +@pytest.mark.usefixtures("with_80_col_terminal") def test_long_lines_in_comparators_are_wrapped_sensibly_multiline(testdir): left = {1: "hello " * 20, 2: 'two'} right = {1: "hella " * 20, 2: 'two'} @@ -207,6 +217,7 @@ def test_one(): assert comparison_line.count('hell') < 13 +@pytest.mark.usefixtures("with_80_col_terminal") def test_long_lines_in_comparators_are_wrapped_sensibly_singleline(testdir): left = "hello " * 10 right = "hella " * 10 @@ -277,6 +288,7 @@ def test_one(): assert f"123456 123456{GREEN_ON}7" in output +@pytest.mark.usefixtures("with_80_col_terminal") def test_really_long_diffs_use_context_mode(testdir): testdir.makepyfile( f""" From ca8de6abd461148fe11d8d0c86dd382b529bdda7 Mon Sep 17 00:00:00 2001 From: Harry Date: Wed, 30 Aug 2023 13:04:39 +0100 Subject: [PATCH 3/4] ok alternative fix --- tests/test_pytest_icdiff.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/tests/test_pytest_icdiff.py b/tests/test_pytest_icdiff.py index d0645af..597f030 100644 --- a/tests/test_pytest_icdiff.py +++ b/tests/test_pytest_icdiff.py @@ -9,12 +9,6 @@ GREEN_ON = '\x1b[1;32m' ANSI_ESCAPE_RE = re.compile(r'(\x9B|\x1B\[)[0-?]*[ -/]*[@-~]') -@pytest.fixture -def with_80_col_terminal(): - # haven't found a better way to simulate terminal sizes - # at a lower level yet sadly. - with mock.patch("pytest_icdiff.COLS", 99): - yield def test_short_dict(testdir): @@ -202,7 +196,6 @@ def test_a(): assert drilldown_expression in output -@pytest.mark.usefixtures("with_80_col_terminal") def test_long_lines_in_comparators_are_wrapped_sensibly_multiline(testdir): left = {1: "hello " * 20, 2: 'two'} right = {1: "hella " * 20, 2: 'two'} @@ -217,7 +210,6 @@ def test_one(): assert comparison_line.count('hell') < 13 -@pytest.mark.usefixtures("with_80_col_terminal") def test_long_lines_in_comparators_are_wrapped_sensibly_singleline(testdir): left = "hello " * 10 right = "hella " * 10 @@ -288,7 +280,6 @@ def test_one(): assert f"123456 123456{GREEN_ON}7" in output -@pytest.mark.usefixtures("with_80_col_terminal") def test_really_long_diffs_use_context_mode(testdir): testdir.makepyfile( f""" @@ -298,6 +289,6 @@ def test_one(): assert one == two """ ) - output = testdir.runpytest('-vv', '--color=yes').stdout.str() + output = testdir.runpytest('-vv', '--color=yes', '-r=no').stdout.str() assert len(output.splitlines()) < 50 assert "---" in output # context split marker From e817937de5890c8f83a2de8a5d42c0e6e76daf3f Mon Sep 17 00:00:00 2001 From: Harry Date: Mon, 4 Sep 2023 18:16:07 +0100 Subject: [PATCH 4/4] bump version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 05a8075..8190a33 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ def read(fname): setup( name="pytest-icdiff", - version="0.6", + version="0.7", author="Harry Percival", author_email="obeythetestinggoat@gmail.com", maintainer="Harry Percival",