Skip to content

Commit

Permalink
Fix coveralls (#245)
Browse files Browse the repository at this point in the history
* Teach Green to properly emit color on GH Actions Windows runners
* Tell coveralls we're running from GitHub
* Bump versions of Python we test with
* Fix a couple new failing black lints
* Consolidate Windows and Posix into one CI file
* CI is so quick, let's not fail fast
  • Loading branch information
CleanCut committed Apr 26, 2021
1 parent 2bdb4ed commit 01405d6
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 48 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/ci-windows.yml

This file was deleted.

27 changes: 16 additions & 11 deletions .github/workflows/ci.yml
Expand Up @@ -11,8 +11,9 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest] # Windows is handled in ci-windows.yml
python-version: [3.6, 3.7, 3.8]
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: [3.7, 3.8, 3.9]
fail-fast: false

steps:
- uses: actions/checkout@v2
Expand All @@ -25,22 +26,26 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install -r requirements-optional.txt
pip install black virtualenv coveralls
pip install --upgrade -r requirements-optional.txt
- name: Lint with black
run: black --check --diff green
run: |
pip install --upgrade black
black --check --diff green
if: matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest'

- name: Test
run: ./g -tvvv green
run: python -m green.cmdline -tvvv green
if: matrix.python-version != '3.9' || matrix.os != 'ubuntu-latest'

- name: Generate coverage
run: ./g -tr green
if: matrix.python-version == '3.8' && matrix.os == 'ubuntu-latest'
run: |
pip install --upgrade coveralls
./g -tvvvr green
if: matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest'

- name: Coveralls
run: coveralls
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: matrix.python-version == '3.8' && matrix.os == 'ubuntu-latest'
if: matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest'
1 change: 0 additions & 1 deletion green/loader.py
Expand Up @@ -191,7 +191,6 @@ def loadTargets(self, targets, file_pattern="test*.py"):
return flattenTestSuite(suites) if suites else None

def loadTarget(self, target, file_pattern="test*.py"):
""""""
debug(
"Attempting to load target '{}' with file_pattern '{}'".format(
target, file_pattern
Expand Down
11 changes: 7 additions & 4 deletions green/output.py
Expand Up @@ -128,13 +128,16 @@ def __init__(
):
self.disable_unidecode = disable_unidecode
self.stream = stream
# Ironically, AppVeyor doesn't support windows win32 system calls for
# colors, but it WILL interpret posix ansi escape codes!
# Ironically, Windows CI platforms such as GitHub Actions and AppVeyor don't support windows
# win32 system calls for colors, but it WILL interpret posix ansi escape codes! (The
# opposite of an actual windows command prompt)
on_windows = platform.system() == "Windows"
on_appveyor = os.environ.get("APPVEYOR", False)
on_windows_ci = os.environ.get("GITHUB_ACTIONS", False) or os.environ.get(
"APPVEYOR", False
)

if override_appveyor or (
(on_windows and not on_appveyor) and not disable_windows
(on_windows and not on_windows_ci) and not disable_windows
): # pragma: no cover
self.stream = wrap_stream(self.stream, None, None, None, True)
# set output is ascii-only
Expand Down
2 changes: 1 addition & 1 deletion green/test/test_suite.py
Expand Up @@ -199,7 +199,7 @@ def tearDown(self):
del self.stream

def test_failedModuleTeardown(self):
""""""
"""A failing tearDownModule gets counted as an errored test"""
sub_tmpdir = tempfile.mkdtemp(dir=self.tmpdir)
fh = open(os.path.join(sub_tmpdir, "test_moduleteardownfailed.py"), "w")
fh.write(
Expand Down

0 comments on commit 01405d6

Please sign in to comment.