Skip to content

Commit 27e42c0

Browse files
committed
Linting.
1 parent 3f412a9 commit 27e42c0

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

domdf_python_tools/terminal.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def _get_terminal_size_windows() -> Optional[Tuple[int, int]]: # pragma: no cov
191191
size_y = bottom - top + 1
192192

193193
return size_x, size_y
194-
except Exception:
194+
except Exception: # nosec: B110
195195
pass
196196

197197
return None
@@ -204,7 +204,7 @@ def _get_terminal_size_tput() -> Optional[Tuple[int, int]]: # pragma: no cover
204204
cols = int(subprocess.check_call(shlex.split("tput cols")))
205205
rows = int(subprocess.check_call(shlex.split("tput lines")))
206206
return cols, rows
207-
except Exception:
207+
except Exception: # nosec: B110
208208
return None
209209

210210

@@ -218,7 +218,7 @@ def ioctl_GWINSZ(fd: int) -> Optional[Tuple[Any, ...]]:
218218
try:
219219
cr = struct.unpack("hh", fcntl.ioctl(fd, termios.TIOCGWINSZ, b"1234"))
220220
return cr
221-
except Exception:
221+
except Exception: # nosec: B110
222222
pass
223223

224224
return None
@@ -230,13 +230,13 @@ def ioctl_GWINSZ(fd: int) -> Optional[Tuple[Any, ...]]:
230230
fd = os.open(os.ctermid(), os.O_RDONLY) # type: ignore
231231
cr = ioctl_GWINSZ(fd)
232232
os.close(fd)
233-
except Exception:
233+
except Exception: # nosec: B110
234234
pass
235235

236236
if not cr:
237237
try:
238238
cr = (os.environ["LINES"], os.environ["COLUMNS"])
239-
except Exception:
239+
except Exception: # nosec: B110
240240
return None
241241

242242
return int(cr[1]), int(cr[0])

tests/test_dates.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
# this package
1717
from domdf_python_tools import dates
18+
from domdf_python_tools.testing import count
1819

1920
test_date = datetime.datetime(1996, 10, 13, 2, 20).replace(tzinfo=pytz.utc)
2021
today = datetime.datetime.utcnow().replace(tzinfo=pytz.utc) # make sure UTC
@@ -173,10 +174,9 @@ def test_get_month_number_from_name(month_idx, month):
173174
assert dates.get_month_number(month) == month_idx
174175

175176

176-
@pytest.mark.parametrize("month_idx", range(1, 13))
177-
def test_get_month_number_from_no(month_idx):
178-
for month_idx in range(1, 13):
179-
assert dates.get_month_number(month_idx) == month_idx
177+
@count(13, 1)
178+
def test_get_month_number_from_no(count):
179+
assert dates.get_month_number(count) == count
180180

181181

182182
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)