Skip to content

Commit 31197e8

Browse files
Remove deprecated program parameter (#92)
1 parent 6c0e46f commit 31197e8

2 files changed

Lines changed: 3 additions & 31 deletions

File tree

fancylog/fancylog.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ def start_logging(
3939
log_to_console=True,
4040
timestamp=True,
4141
logger_name=None,
42-
program=None,
4342
):
4443
"""Prepare the log file, and then begin logging.
4544
@@ -84,8 +83,6 @@ def start_logging(
8483
logger_name
8584
If None, logger uses default logger; otherwise, logger
8685
name is set to `logger_name`.
87-
program
88-
Deprecated alias name for `package`.
8986
9087
Returns
9188
-------
@@ -96,20 +93,8 @@ def start_logging(
9693
output_dir = str(output_dir)
9794
print_log_level = "DEBUG" if verbose else "INFO"
9895

99-
if program:
100-
warnings.warn(
101-
"`program` is deprecated since 0.6.0 and will be "
102-
"removed in 0.7.0; use `package` instead.",
103-
DeprecationWarning,
104-
stacklevel=2,
105-
)
106-
package = program
107-
10896
if not package:
109-
raise ValueError(
110-
"`package` or `program` (deprecated)` must be "
111-
"passed to `start_logging()`."
112-
)
97+
raise ValueError("`package` must be passed to `start_logging()`.")
11398

11499
if log_to_file:
115100
if filename is None:

tests/tests/test_deprecations.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,9 @@
55

66
def test_no_package_passed(tmp_path):
77
"""
8-
Test error is wrong if neither `package` or
9-
`program` (deprecated) is raised.
8+
Test error is raised if `package` is not passed.
109
"""
1110
with pytest.raises(ValueError) as e:
1211
fancylog.start_logging(tmp_path)
1312

14-
assert "`package` or `program`" in str(e.value)
15-
16-
17-
def test_program_warning_shown(tmp_path):
18-
"""
19-
Test depreciation warning is shown for `program`.
20-
"""
21-
with pytest.warns(DeprecationWarning) as w:
22-
fancylog.start_logging(tmp_path, program=fancylog)
23-
assert (
24-
"`program` is deprecated since 0.6.0 and will be removed in 0.7.0;"
25-
in str(w[0].message)
26-
)
13+
assert "`package` must be passed" in str(e.value)

0 commit comments

Comments
 (0)