Skip to content

Commit 90b09fa

Browse files
committed
fix coverage analysis, trying to at least
Signed-off-by: DONNOT Benjamin <benjamin.donnot@rte-france.com>
1 parent ba7a85c commit 90b09fa

7 files changed

Lines changed: 26 additions & 15 deletions

File tree

.coveragerc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ exclude_lines =
88
raise NotImplementedError
99
if 0:
1010
if __name__ == .__main__.:
11+
import
1112
omit =
1213
# omit anything in a .local directory anywhere
1314
*/.local/*
@@ -23,6 +24,16 @@ omit =
2324
dtypes.py
2425

2526
[run]
27+
exclude_lines =
28+
pragma: no cover
29+
def __repr__
30+
if self.debug:
31+
if settings.DEBUG
32+
raise AssertionError
33+
raise NotImplementedError
34+
if 0:
35+
if __name__ == .__main__.:
36+
import
2637
omit =
2738
# omit anything in a .local directory anywhere
2839
*/.local/*

grid2op/Download/DownloadDataset.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
try:
1919
import urllib.parse
2020
import urllib.request
21-
except Exception as exc_:
21+
except Exception as exc_: # pragma: no cover
2222
raise RuntimeError(f"Impossible to find library urllib. Please install it, error was:\n{exc_}.")
2323

2424
URL_GRID2OP_DATA = "https://github.com/Tezirg/Grid2Op/releases/download/{}/{}"
@@ -44,7 +44,7 @@
4444
_MAX_COMPRESSION_RATIO = 100 # reject archives that expand more than 100×
4545

4646

47-
class DownloadProgressBar(tqdm):
47+
class DownloadProgressBar(tqdm): # pragma: no cover
4848
"""
4949
INTERNAL
5050
@@ -59,7 +59,7 @@ def update_to(self, b=1, bsize=1, tsize=None):
5959
self.update(b * bsize - self.n)
6060

6161

62-
def download_url(url, output_path):
62+
def download_url(url, output_path): # pragma: no cover
6363
"""
6464
INTERNAL
6565
@@ -87,7 +87,7 @@ def download_url(url, output_path):
8787
urllib.request.urlretrieve(url, filename=output_path, reporthook=t.update_to)
8888

8989

90-
def _aux_download(url, dataset_name, path_data, ds_name_dl=None):
90+
def _aux_download(url, dataset_name, path_data, ds_name_dl=None): # pragma: no cover
9191
"""
9292
INTERNAL
9393
@@ -180,7 +180,7 @@ def _aux_download(url, dataset_name, path_data, ds_name_dl=None):
180180
)
181181

182182

183-
def main_download(dataset_name, path_data):
183+
def main_download(dataset_name, path_data): # pragma: no cover
184184
"""
185185
INTERNAL
186186

grid2op/Plot/BasePlot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from grid2op.Exceptions import PlotError
2525

2626

27-
class BasePlot(GridObjects):
27+
class BasePlot(GridObjects): # pragma: no cover
2828
"""
2929
INTERNAL
3030

grid2op/Plot/EpisodeReplay.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
can_save_gif = False
3737

3838

39-
class EpisodeReplay(object):
39+
class EpisodeReplay(object): # pragma: no cover
4040
"""
4141
INTERNAL
4242

grid2op/Plot/PlotMatplotlib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
from matplotlib.lines import Line2D # type: ignore
4444

4545
can_plot = True
46-
except ImportError as exc_: # noqa: F841
46+
except ImportError as exc_: # noqa: F841 # pragma: no cover
4747
can_plot = False
4848
pass
4949

grid2op/Plot/PlotPlotly.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@
5555
import seaborn as sns # type: ignore
5656

5757
can_plot = True
58-
except ImportError:
58+
except ImportError: # pragma: no cover
5959
can_plot = False
6060
pass
6161

6262
# TODO add tests there
6363

6464

6565
# Some utilities to plot substation, lines or get the color id for the colormap.
66-
def draw_sub(pos, radius=50, line_color="LightSeaGreen"):
66+
def draw_sub(pos, radius=50, line_color="LightSeaGreen"): # pragma: no cover
6767
"""
6868
INTERNAL
6969
@@ -100,7 +100,7 @@ def draw_sub(pos, radius=50, line_color="LightSeaGreen"):
100100
return res
101101

102102

103-
def get_col(rho):
103+
def get_col(rho): # pragma: no cover
104104
"""
105105
INTERNAL
106106
@@ -132,7 +132,7 @@ def get_col(rho):
132132
return 6
133133

134134

135-
def draw_line(pos_sub_or, pos_sub_ex, rho, color_palette, status, line_color="gray"):
135+
def draw_line(pos_sub_or, pos_sub_ex, rho, color_palette, status, line_color="gray"): # pragma: no cover
136136
"""
137137
INTERNAL
138138

grid2op/Plot/PlotPyGame.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
pass
3535

3636

37-
class Point:
37+
class Point: # pragma: no cover
3838
# https://codereview.stackexchange.com/questions/70143/drawing-a-dashed-line-with-pygame
3939
# constructed using a normal tupple
4040
def __init__(self, point_t=(0, 0)):
@@ -75,7 +75,7 @@ def from_cplx(cplx):
7575
return Point((cplx.real, cplx.imag))
7676

7777

78-
def _draw_dashed_line(surf, color, start_pos, end_pos, width=1, dash_length=10):
78+
def _draw_dashed_line(surf, color, start_pos, end_pos, width=1, dash_length=10): # pragma: no cover
7979
# https://codereview.stackexchange.com/questions/70143/drawing-a-dashed-line-with-pygame
8080
origin = Point(start_pos)
8181
target = Point(end_pos)
@@ -99,7 +99,7 @@ def _draw_arrow(
9999
num_arrows=10,
100100
length_arrow=10,
101101
angle_arrow=30,
102-
):
102+
): # pragma: no cover
103103
if positive_flow:
104104
origin = Point(start_pos)
105105
target = Point(end_pos)

0 commit comments

Comments
 (0)