Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/CleanCut/green into 3.5.0
Browse files Browse the repository at this point in the history
* 'main' of https://github.com/CleanCut/green:
  ignore installed versions of green in folders that look like green-*
  bump for version 4.0.0
  update changelog
  Lift minimum supported Python version from 3.6 to 3.8
  Address 'addDuration' warnings in python 3.12.
  don't try to find Python 2's readfp method
  update CI python versions

# Conflicts:
#	.github/workflows/ci.yml
#	CHANGELOG.md
#	green/VERSION
  • Loading branch information
sodul committed Jan 13, 2024
2 parents c3ebfb5 + 4f6ab77 commit ec8a8ca
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 24 deletions.
16 changes: 5 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@ jobs:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: [
"3.6", "3.7", "3.8", "3.9", "3.10", "3.11",
"pypy3.8", "pypy3.9", "pypy3.10"
]
exclude:
- os: ubuntu-latest # Ubuntu-latest can only install 3.7+.
python-version: 3.6
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
fail-fast: false

steps:
Expand All @@ -39,11 +33,11 @@ jobs:
- name: Format
run: black --check --diff green example
if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest'
if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest'

- name: Mypy
run: mypy .
if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest'
if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest'

- name: Test
run: |
Expand All @@ -54,10 +48,10 @@ jobs:
run: |
pip install --upgrade coveralls
green -tvvvvr green
if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest'
if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest'

- name: Coveralls
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest'
if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest'
28 changes: 27 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,34 @@
# Unreleased
#### Date TBD

# Version 4.0.0
#### 12 Jan 2024

The biggest change in this release is the addition of support for new Python versions up through 3.12, and the dropping of support for Python < 3.8, including Python 2 entirely.

- Fix an error and warnings that occur with Python 3.12. Contributed by [`@sodul`](https://github.com/sodul) in [#272], [#274], and [#275].
- Add setup.cfg and pyproject.toml to support the setup.py deprecation in pip 23.
- Lift minimum supported Python version from 3.5 to 3.8.
- CI Improvements:
- Add 3.12 to the CI Action
- Add button to run CI checks manually
- Add 15 minute timeout to CI checks
- Update CI to pip install green in developer mode
- Add `mypy` linting & fix lint warnings
- Use `pyupgrade` to modernize code
- Use `black` to autoformat code
- Add `pyproject.toml`
- Move `setup.py` logic into `setup.cfg`
- README cleanup
- Fixes for newer versions of coverage


[#272]: https://github.com/CleanCut/green/issues/272
[#274]: https://github.com/CleanCut/green/pull/274
[#275]: https://github.com/CleanCut/green/pull/275

# Version 3.5.0
#### 4 Dec 2023
#### 12 Jan 2024

This is the final version to support Python 3.6 and 3.7.

Expand Down
2 changes: 1 addition & 1 deletion README-pypi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Features
- **Descriptive** - Multiple verbosity levels, from just dots to full docstring output.
- **Convenient** - Bash-completion and ZSH-completion of options and test targets.
- **Thorough** - Built-in integration with `coverage`_
- **Modern** - Supports Python 3.6+. Additionally, `PyPy` is supported on a best-effort basis.
- **Modern** - Supports Python 3.8+. Additionally, `PyPy` is supported on a best-effort basis.
- **Portable** - macOS, Linux, and BSDs are fully supported. Windows is supported on a best-effort basis.
- **Living** - This project grows and changes. See the `changelog`_

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Features
- **Convenient** - Bash-completion and ZSH-completion of options and test targets.
- **Thorough** - Built-in integration with [coverage](http://nedbatchelder.com/code/coverage/).
- **Embedded** - Can be run with a setup command without in-site installation.
- **Modern** - Supports Python 3.6+. Additionally, [PyPy](http://pypy.org) is supported on a best-effort basis.
- **Modern** - Supports Python 3.8+. Additionally, [PyPy](http://pypy.org) is supported on a best-effort basis.
- **Portable** - macOS, Linux, and BSDs are fully supported. Windows is supported on a best-effort basis.
- **Living** - This project grows and changes. See the
[changelog](https://github.com/CleanCut/green/blob/main/CHANGELOG.md)
Expand Down Expand Up @@ -394,7 +394,7 @@ Green can also run tests embedded in documentation via Python's built-in
[doctest] module. Returning to our previous example, we could add docstrings
with example code to our `foo.py` module:

[doctest]: https://docs.python.org/3.6/library/doctest.html
[doctest]: https://docs.python.org/3.12/library/doctest.html


```python
Expand Down
2 changes: 1 addition & 1 deletion green/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.5.0
4.0.0
7 changes: 2 additions & 5 deletions green/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,17 +634,14 @@ def getConfig(filepath=None): # pragma: no cover
if filepaths:
global files_loaded
files_loaded = filepaths
# Python 3 has parser.read_file(iterator) while Python2 has
# parser.readfp(obj_with_readline)
read_func = getattr(parser, "read_file", getattr(parser, "readfp"))
for filepath in filepaths:
# Users are expected to put a [green] section
# only if they use setup.cfg
if filepath.endswith("setup.cfg"):
with open(filepath) as f:
read_func(f)
parser.read_file(f)
else:
read_func(ConfigFile(filepath))
parser.read_file(ConfigFile(filepath))

return parser

Expand Down
17 changes: 17 additions & 0 deletions green/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ def __init__(self, stream, colors):
self.stderr_errput = OrderedDict()
self.stream = stream
self.colors = colors
# The collectedDurations list is new in Python 3.12.
self.collectedDurations = []

def recordStdout(self, test, output):
"""
Expand Down Expand Up @@ -218,6 +220,19 @@ def displayStderr(self, test):
)
del self.stderr_errput[test]

def addDuration(self, test, elapsed):
"""
Called when a test finished running, regardless of its outcome.
New in Python 3.12.
Args:
test: The test case corresponding to the test method.
elapsed: The time represented in seconds, including the
execution of cleanup functions.
"""
self.collectedDurations.append((str(test), elapsed))


class ProtoTestResult(BaseTestResult):
"""
Expand Down Expand Up @@ -247,6 +262,7 @@ def __init__(self, start_callback=None, finalize_callback=None):

def reinitialize(self):
self.shouldStop = False
self.collectedDurations = []
self.errors = []
self.expectedFailures = []
self.failures = []
Expand Down Expand Up @@ -392,6 +408,7 @@ def __init__(self, args, stream):
self.shouldStop = False
self.testsRun = 0
# Individual lists
self.collectedDurations = []
self.errors = []
self.expectedFailures = []
self.failures = []
Expand Down
5 changes: 2 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@ classifier =
Operating System :: Unix
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3 :: Only
Topic :: Software Development :: Libraries
Topic :: Software Development :: Quality Assurance
Expand Down Expand Up @@ -67,7 +66,7 @@ test_suite='green.test'


[options]
python_requires = >=3.6
python_requires = >=3.8
# The file:requirements.txt syntax is not compatible until Python 3.7.
# install_requires = file:requirements.txt
install_requires =
Expand Down

0 comments on commit ec8a8ca

Please sign in to comment.