Skip to content

Commit

Permalink
Add color output to tests in CI (#15774)
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek authored Sep 7, 2023
1 parent 526b71c commit c758504
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test-target.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ jobs:
runs-on: ${{ fromJson(inputs.runner) }}

env:
FORCE_COLOR: "1"
PYTHON_VERSION: "${{ inputs.python-version || '3.9' }}"
PYTHON_FILTER: "${{ (inputs.test-py2 && !inputs.test-py3) && '2.7' || (!inputs.test-py2 && inputs.test-py3) && '3.9' || '' }}"
SKIP_ENV_NAME: "${{ (inputs.test-py2 && !inputs.test-py3) && 'py3.*' || (!inputs.test-py2 && inputs.test-py3) && 'py2.*' || '' }}"
Expand Down
4 changes: 4 additions & 0 deletions ddev/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

***Added***:

* Add color output to tests in CI ([#15774](https://github.com/DataDog/integrations-core/pull/15774))

## 5.0.0 / 2023-09-06

***Removed***:
Expand Down
2 changes: 1 addition & 1 deletion ddev/src/ddev/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
@click.option(
'--color/--no-color',
default=None,
help='Whether or not to display colored output (default is auto-detection) [env vars: `DDEV_COLOR`/`NO_COLOR`]',
help='Whether or not to display colored output (default is auto-detection) [env vars: `FORCE_COLOR`/`NO_COLOR`]',
)
@click.option(
'--interactive/--no-interactive',
Expand Down
4 changes: 3 additions & 1 deletion ddev/src/ddev/cli/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ def test(

return

in_ci = running_in_ci()

global_env_vars: dict[str, str] = {}

hatch_verbosity = app.verbosity + 1
Expand Down Expand Up @@ -225,7 +227,7 @@ def test(
app.display_header('Coverage report')
app.platform.check_command([sys.executable, '-m', 'coverage', 'report', '--rcfile=../.coveragerc'])

if running_in_ci():
if in_ci:
app.platform.check_command(
[sys.executable, '-m', 'coverage', 'xml', '-i', '--rcfile=../.coveragerc']
)
Expand Down
2 changes: 1 addition & 1 deletion ddev/src/ddev/config/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class AppEnvVars:
VERBOSE = 'DDEV_VERBOSE'
# https://no-color.org
NO_COLOR = 'NO_COLOR'
FORCE_COLOR = 'DDEV_COLOR'
FORCE_COLOR = 'FORCE_COLOR'


class ConfigEnvVars:
Expand Down
1 change: 1 addition & 0 deletions ddev/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def valid_integration(valid_integrations) -> str:
@pytest.fixture(autouse=True)
def config_file(tmp_path, monkeypatch, local_repo) -> ConfigFile:
for env_var in (
'FORCE_COLOR',
'DD_ENV',
'DD_SERVICE',
'DD_SITE',
Expand Down
2 changes: 1 addition & 1 deletion ddev/tests/validation/test_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

def get_tracker():
return ValidationTracker(
Console(),
Console(no_color=True, legacy_windows=True),
Tree('validate test', style=Style.parse('bold')),
success_style=Style.parse('bold cyan'),
error_style=Style.parse('bold red'),
Expand Down

0 comments on commit c758504

Please sign in to comment.