Skip to content

Commit

Permalink
Fix tabulate for windows (#2593)
Browse files Browse the repository at this point in the history
### Changes

Use grids without unsupported symbols for windows

### Related tickets

136331
  • Loading branch information
AlexanderDokuchaev authored Mar 26, 2024
1 parent b6e1aa9 commit 3d3b797
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 5 additions & 0 deletions nncf/common/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

from tabulate import tabulate

from nncf.common.utils.os import is_windows


def create_table(
header: List[str],
Expand All @@ -35,6 +37,9 @@ def create_table(
if not rows:
# For empty rows max_col_widths raises IndexError
max_col_widths = None
if is_windows():
# Not all terminals on Windows supports any format of table
table_fmt = "grid"
return tabulate(tabular_data=rows, headers=header, tablefmt=table_fmt, maxcolwidths=max_col_widths, floatfmt=".3f")


Expand Down
7 changes: 1 addition & 6 deletions tests/cross_fw/examples/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import os
import subprocess
import sys
from pathlib import Path
from typing import Any, Dict, List

Expand All @@ -37,15 +36,11 @@
MODEL_SIZE_METRICS = "model_size_metrics"
PERFORMANCE_METRICS = "performance_metrics"

XFAILS = {
"quantization_aware_training_torch_resnet18": pytest.mark.xfail(sys.platform == "win32", reason="Ticket 136331"),
}


def example_test_cases():
example_scope = load_json(EXAMPLE_SCOPE_PATH)
for example_name, example_params in example_scope.items():
yield pytest.param(example_name, example_params, id=example_name, marks=XFAILS.get(example_name, ()))
yield pytest.param(example_name, example_params, id=example_name)


@pytest.mark.parametrize("example_name, example_params", example_test_cases())
Expand Down

0 comments on commit 3d3b797

Please sign in to comment.