From 1edbf2b456b495cc020aca2fe11e842c95301481 Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Fri, 21 Apr 2023 06:05:04 -0600 Subject: [PATCH 1/7] .github: Add CI for pypy series (#159) Co-authored-by: Hugo van Kemenade --- .github/workflows/build.yml | 6 ++++++ pyperf/tests/test_timeit.py | 18 ++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 131dd6dc..8092e51a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,6 +14,12 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest] python: ['3.11'] include: + - os: ubuntu-latest + python: 'pypy3.9' + - os: ubuntu-latest + python: 'pypy3.8' + - os: ubuntu-latest + python: 'pypy3.7' - os: ubuntu-latest python: '3.7' - os: ubuntu-latest diff --git a/pyperf/tests/test_timeit.py b/pyperf/tests/test_timeit.py index 1ce1c9a1..4b2b9b17 100644 --- a/pyperf/tests/test_timeit.py +++ b/pyperf/tests/test_timeit.py @@ -392,22 +392,24 @@ def test_raises_if_setup_and_stmt_contain_invalid_syntax(self): Timer(setup="foo = 'bar', \\ ", stmt="bar = 'baz'") err = cm.exception + found = False + for msg in ["Unknown character", "unexpected character after line"]: + if msg in str(err): + found = True - if PYPY: - self.assertTrue("Unknown character" in str(err)) - else: - self.assertTrue('unexpected character after line' in str(err)) + self.assertTrue(found) def test_raises_if_stmt_and_teardown_contain_invalid_syntax(self): with self.assertRaises(SyntaxError) as cm: Timer(stmt="foo = 'bar', \\ ", teardown="bar = 'baz'") err = cm.exception + found = False + for msg in ["Unknown character", "unexpected character after line"]: + if msg in str(err): + found = True - if PYPY: - self.assertTrue("Unknown character" in str(err)) - else: - self.assertTrue('unexpected character after line' in str(err)) + self.assertTrue(found) def test_returns_valid_template_if_setup_is_str(self): setup = "foo = 'bar'\nbar = 'baz'" From 8dc692f1b1ba7cca02c741cb85326a0979c4a6b0 Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Sat, 3 Jun 2023 16:59:53 +0900 Subject: [PATCH 2/7] .github: Use Trusted Publishers for deploy (#163) --- .github/workflows/publish.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3068f91a..719f1ef6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,6 +8,10 @@ jobs: deploy: runs-on: ubuntu-latest + permission: + # IMPORTANT: this permission is mandatory for trusted publishing + id-token: write + steps: - uses: actions/checkout@v3 - name: Set up Python @@ -26,6 +30,3 @@ jobs: - name: Publish distribution 📦 to PyPI if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} From f4db4617cc121db62d45cf82ea503ba9c061f2b9 Mon Sep 17 00:00:00 2001 From: Colton Myers Date: Sun, 11 Jun 2023 09:21:49 -0600 Subject: [PATCH 3/7] Fix tracemalloc error when action isn't defined (#161) --- doc/changelog.rst | 6 ++++++ pyperf/_runner.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index fe931d4a..6024396e 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -1,6 +1,12 @@ Changelog ========= +Version 2.6.1 +------------- + +* Fix a possible attribute error in argument parsing. + Patch by Colton Myers + Version 2.6.0 (2023-03-22) -------------------------- diff --git a/pyperf/_runner.py b/pyperf/_runner.py index a1613b7c..58776f60 100644 --- a/pyperf/_runner.py +++ b/pyperf/_runner.py @@ -331,7 +331,7 @@ def _process_args_impl(self): self._only_in_worker("--worker-task") if args.tracemalloc: - if args.action == 'command': + if getattr(args, 'action', None) == 'command': raise CLIError('--tracemalloc cannot be used with pyperf command') try: import tracemalloc # noqa From 029f353e124c39f3084ac51521c23da280d2a22d Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Mon, 12 Jun 2023 00:24:34 +0900 Subject: [PATCH 4/7] Prepare 2.6.1 --- doc/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/conf.py b/doc/conf.py index 9f5a50a3..8c3c4ed4 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -51,7 +51,7 @@ # built documents. # # The short X.Y version. -version = release = '2.6.0' +version = release = '2.6.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From bf004ac56fecdc0f4d2dcb7a75966c02353e79fe Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Mon, 12 Jun 2023 00:25:20 +0900 Subject: [PATCH 5/7] Update changelog.rst for 2.6.1 --- doc/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index 6024396e..b7eabe60 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -1,7 +1,7 @@ Changelog ========= -Version 2.6.1 +Version 2.6.1 (2023-06-12) ------------- * Fix a possible attribute error in argument parsing. From 857c0381be3acfc0c0e67d3cc6bd5a72d0eaa85b Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Mon, 12 Jun 2023 00:39:02 +0900 Subject: [PATCH 6/7] Bump up the version into 2.6.1 --- pyperf/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyperf/__init__.py b/pyperf/__init__.py index 3acbc1c7..d4ff4f3a 100644 --- a/pyperf/__init__.py +++ b/pyperf/__init__.py @@ -1,6 +1,6 @@ from time import perf_counter -VERSION = (2, 6, 0) +VERSION = (2, 6, 1) __version__ = '.'.join(map(str, VERSION)) # Export pyperf.perf_counter for backward compatibility with pyperf 1.7 From cbe4adc3ce35ac818b0e32ec5ed833570aebb1d7 Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Mon, 12 Jun 2023 01:09:40 +0900 Subject: [PATCH 7/7] .github: Fix typo of permissions (#164) --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 719f1ef6..ab0fa635 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,7 +8,7 @@ jobs: deploy: runs-on: ubuntu-latest - permission: + permissions: # IMPORTANT: this permission is mandatory for trusted publishing id-token: write