Skip to content

Commit c2b5ea0

Browse files
committed
Renamed test constant.
1 parent d2775db commit c2b5ea0

File tree

7 files changed

+28
-28
lines changed

7 files changed

+28
-28
lines changed

test/_constant/interval.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ULTRA_SHORT_INTERVAL: float = 0.001 # 1 millisecond.
1+
ONE_MILLISECOND_AS_SECOND: float = 0.001

test/timer/exception_handling/soft_error/stop_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from os import linesep
33

44
import pytest
5-
from _constant.interval import ULTRA_SHORT_INTERVAL
5+
from _constant.interval import ONE_MILLISECOND_AS_SECOND
66
from _helper import operating_system
77
from _helper.random import random_thread_name, random_thread_name_but_not
88
from _helper.timer import ensure_all_timer_threads_are_stopped
@@ -18,7 +18,7 @@ def test_timer_stop_unknown_thread_soft_error_with_default_and_custom_thread(cap
1818
custom_thread = random_thread_name()
1919
timer = ensure_all_timer_threads_are_stopped()
2020
timer.start()
21-
time.sleep(ULTRA_SHORT_INTERVAL)
21+
time.sleep(ONE_MILLISECOND_AS_SECOND)
2222
timer.stop(thread=custom_thread)
2323
terminal_output, _ = capfd.readouterr()
2424
assert terminal_output == \
@@ -36,7 +36,7 @@ def test_timer_stop_unknown_thread_soft_error_with_multiple_custom_threads(capfd
3636
custom_thread_2 = random_thread_name_but_not(custom_thread_1)
3737
timer = ensure_all_timer_threads_are_stopped()
3838
timer.start(thread=custom_thread_1)
39-
time.sleep(ULTRA_SHORT_INTERVAL)
39+
time.sleep(ONE_MILLISECOND_AS_SECOND)
4040
timer.stop(thread=custom_thread_2)
4141
terminal_output, _ = capfd.readouterr()
4242
assert terminal_output == \

test/timer/successful_output/decimals_2_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import re
22
import time
33

4-
from _constant.interval import ULTRA_SHORT_INTERVAL
4+
from _constant.interval import ONE_MILLISECOND_AS_SECOND
55
from _helper.terminal_output import successful_output_regex
66
from _helper.timer import ensure_all_timer_threads_are_stopped
77

@@ -13,7 +13,7 @@ def test_timer_decimals_output(capfd: object) -> None:
1313
ensure_all_timer_threads_are_stopped()
1414
for decimals in range(MINIMUM, MAXIMUM + 1):
1515
with Timer(decimals=decimals):
16-
time.sleep(ULTRA_SHORT_INTERVAL)
16+
time.sleep(ONE_MILLISECOND_AS_SECOND)
1717
terminal_output, _ = capfd.readouterr()
1818
expected_output_regex = successful_output_regex(decimals=decimals)
1919
assert re.fullmatch(expected_output_regex, terminal_output)

test/timer/successful_output/decorator/function_with_arguments_test.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from typing import Any
55

66
import pytest
7-
from _constant.interval import ULTRA_SHORT_INTERVAL
7+
from _constant.interval import ONE_MILLISECOND_AS_SECOND
88
from _helper.terminal_output import successful_output_regex
99
from _helper.timer import ensure_all_timer_threads_are_stopped
1010

@@ -17,32 +17,32 @@
1717

1818
@function_timer()
1919
def function_with_args(a: int, b: int) -> None:
20-
time.sleep(ULTRA_SHORT_INTERVAL)
20+
time.sleep(ONE_MILLISECOND_AS_SECOND)
2121

2222

2323
@function_timer()
2424
def function_with_kwargs(x: int = 1, y: int = 2) -> None:
25-
time.sleep(ULTRA_SHORT_INTERVAL)
25+
time.sleep(ONE_MILLISECOND_AS_SECOND)
2626

2727

2828
@function_timer()
2929
def function_with_args_and_kwargs(a: int, b: int, x: int = 3, y: int = 4) -> None:
30-
time.sleep(ULTRA_SHORT_INTERVAL)
30+
time.sleep(ONE_MILLISECOND_AS_SECOND)
3131

3232

3333
@function_timer()
3434
def function_with_args_and_kwargs_number_and_strings(a: int, b: str, x: int = 3, y: str = "4") -> None:
35-
time.sleep(ULTRA_SHORT_INTERVAL)
35+
time.sleep(ONE_MILLISECOND_AS_SECOND)
3636

3737

3838
@function_timer(thread=CUSTOM_THREAD)
3939
def function_with_args_kwargs_and_custom_thread(a: int, b: int, x: int = 3, y: int = 4) -> None:
40-
time.sleep(ULTRA_SHORT_INTERVAL)
40+
time.sleep(ONE_MILLISECOND_AS_SECOND)
4141

4242

4343
@function_timer(thread=CUSTOM_THREAD, decimals=CUSTOM_DECIMALS)
4444
def function_with_args_kwargs_custom_thread_and_custom_decimals(a: int, b: int, x: int = 3, y: int = 4) -> None:
45-
time.sleep(ULTRA_SHORT_INTERVAL)
45+
time.sleep(ONE_MILLISECOND_AS_SECOND)
4646

4747

4848
@pytest.mark.parametrize("function, args, kwargs, expected_thread_name, decimals", [

test/timer/successful_output/decorator/function_without_arguments_test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from collections.abc import Callable
44

55
import pytest
6-
from _constant.interval import ULTRA_SHORT_INTERVAL
6+
from _constant.interval import ONE_MILLISECOND_AS_SECOND
77
from _helper.terminal_output import successful_output_regex
88
from _helper.timer import ensure_all_timer_threads_are_stopped
99

@@ -15,22 +15,22 @@
1515

1616
@function_timer()
1717
def function_to_be_timed() -> None:
18-
time.sleep(ULTRA_SHORT_INTERVAL)
18+
time.sleep(ONE_MILLISECOND_AS_SECOND)
1919

2020

2121
@function_timer(thread=CUSTOM_THREAD)
2222
def function_to_be_timed_with_custom_thread() -> None:
23-
time.sleep(ULTRA_SHORT_INTERVAL)
23+
time.sleep(ONE_MILLISECOND_AS_SECOND)
2424

2525

2626
@function_timer(decimals=CUSTOM_DECIMALS)
2727
def function_to_be_timed_with_custom_decimals() -> None:
28-
time.sleep(ULTRA_SHORT_INTERVAL)
28+
time.sleep(ONE_MILLISECOND_AS_SECOND)
2929

3030

3131
@function_timer(thread=CUSTOM_THREAD, decimals=CUSTOM_DECIMALS)
3232
def function_to_be_timed_with_custom_thread_and_decimals() -> None:
33-
time.sleep(ULTRA_SHORT_INTERVAL)
33+
time.sleep(ONE_MILLISECOND_AS_SECOND)
3434

3535

3636
@pytest.mark.parametrize("function, thread, decimals", [

test/timer/successful_output/thread_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import re
22
import time
33

4-
from _constant.interval import ULTRA_SHORT_INTERVAL
4+
from _constant.interval import ONE_MILLISECOND_AS_SECOND
55
from _helper.random import random_thread_name
66
from _helper.terminal_output import successful_output_regex
77
from _helper.timer import ensure_all_timer_threads_are_stopped
@@ -13,7 +13,7 @@ def test_timer_thread_output(capfd: object) -> None:
1313
ensure_all_timer_threads_are_stopped()
1414
custom_thread = random_thread_name()
1515
with Timer(thread=custom_thread):
16-
time.sleep(ULTRA_SHORT_INTERVAL)
16+
time.sleep(ONE_MILLISECOND_AS_SECOND)
1717
terminal_output, _ = capfd.readouterr()
1818
expected_output_regex = successful_output_regex(thread=custom_thread)
1919
assert re.fullmatch(expected_output_regex, terminal_output)

test/various/with_statement_context_manager_test.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import time
22

3-
from _constant.interval import ULTRA_SHORT_INTERVAL
3+
from _constant.interval import ONE_MILLISECOND_AS_SECOND
44
from _helper.random import random_thread_name
55
from _helper.terminal_output import (verify_decimals_in_terminal_output,
66
verify_prefix_in_terminal_output)
@@ -12,15 +12,15 @@
1212

1313
def test_with_statement_context_manager(capfd: object) -> None:
1414
with Timer():
15-
time.sleep(ULTRA_SHORT_INTERVAL)
15+
time.sleep(ONE_MILLISECOND_AS_SECOND)
1616
terminal_output, _ = capfd.readouterr()
1717
assert verify_prefix_in_terminal_output(terminal_output)
1818

1919

2020
def test_with_statement_context_manager_with_thread(capfd: object) -> None:
2121
thread = random_thread_name(4)
2222
with Timer(thread=thread):
23-
time.sleep(ULTRA_SHORT_INTERVAL)
23+
time.sleep(ONE_MILLISECOND_AS_SECOND)
2424
terminal_output, _ = capfd.readouterr()
2525
assert verify_prefix_in_terminal_output(terminal_output)
2626
assert thread in terminal_output
@@ -29,7 +29,7 @@ def test_with_statement_context_manager_with_thread(capfd: object) -> None:
2929
def test_with_statement_context_manager_with_decimals(capfd: object) -> None:
3030
for decimals in DECIMALS_RANGE:
3131
with Timer(decimals=decimals):
32-
time.sleep(ULTRA_SHORT_INTERVAL)
32+
time.sleep(ONE_MILLISECOND_AS_SECOND)
3333
terminal_output, _ = capfd.readouterr()
3434
assert verify_prefix_in_terminal_output(terminal_output)
3535
assert verify_decimals_in_terminal_output(decimals, terminal_output)
@@ -39,7 +39,7 @@ def test_with_statement_context_manager_with_thread_1nd_decimals(capfd: object)
3939
thread = random_thread_name(4)
4040
for decimals in DECIMALS_RANGE:
4141
with Timer(thread=thread, decimals=decimals):
42-
time.sleep(ULTRA_SHORT_INTERVAL)
42+
time.sleep(ONE_MILLISECOND_AS_SECOND)
4343
terminal_output, _ = capfd.readouterr()
4444
assert verify_prefix_in_terminal_output(terminal_output)
4545
assert thread in terminal_output
@@ -52,9 +52,9 @@ def test_with_statement_context_manager_with_multiple_nested_threads_and_decimal
5252
for decimals in DECIMALS_RANGE:
5353
with Timer():
5454
with Timer(thread=thread_1, decimals=decimals):
55-
time.sleep(ULTRA_SHORT_INTERVAL)
55+
time.sleep(ONE_MILLISECOND_AS_SECOND)
5656
with Timer(thread=thread_2):
57-
time.sleep(ULTRA_SHORT_INTERVAL)
57+
time.sleep(ONE_MILLISECOND_AS_SECOND)
5858
terminal_output_1, _ = capfd.readouterr()
5959
assert verify_prefix_in_terminal_output(terminal_output_1)
6060
assert thread_2 in terminal_output_1
@@ -72,7 +72,7 @@ def test_mix_of_context_manager_standard(capfd: object) -> None:
7272
timer = Timer()
7373
timer.start(thread=thread)
7474
with Timer():
75-
time.sleep(ULTRA_SHORT_INTERVAL)
75+
time.sleep(ONE_MILLISECOND_AS_SECOND)
7676
terminal_output_1, _ = capfd.readouterr()
7777
assert verify_prefix_in_terminal_output(terminal_output_1)
7878
timer.stop(thread)

0 commit comments

Comments
 (0)