Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions fancylog/fancylog.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def start_logging(
log_to_console=True,
timestamp=True,
logger_name=None,
program=None,
):
"""Prepare the log file, and then begin logging.

Expand Down Expand Up @@ -84,8 +83,6 @@ def start_logging(
logger_name
If None, logger uses default logger; otherwise, logger
name is set to `logger_name`.
program
Deprecated alias name for `package`.

Returns
-------
Expand All @@ -96,20 +93,8 @@ def start_logging(
output_dir = str(output_dir)
print_log_level = "DEBUG" if verbose else "INFO"

if program:
warnings.warn(
"`program` is deprecated since 0.6.0 and will be "
"removed in 0.7.0; use `package` instead.",
DeprecationWarning,
stacklevel=2,
)
package = program

if not package:
raise ValueError(
"`package` or `program` (deprecated)` must be "
"passed to `start_logging()`."
)
raise ValueError("`package` must be passed to `start_logging()`.")

if log_to_file:
if filename is None:
Expand Down
17 changes: 2 additions & 15 deletions tests/tests/test_deprecations.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,9 @@

def test_no_package_passed(tmp_path):
"""
Test error is wrong if neither `package` or
`program` (deprecated) is raised.
Test error is raised if `package` is not passed.
"""
with pytest.raises(ValueError) as e:
fancylog.start_logging(tmp_path)

assert "`package` or `program`" in str(e.value)


def test_program_warning_shown(tmp_path):
"""
Test depreciation warning is shown for `program`.
"""
with pytest.warns(DeprecationWarning) as w:
fancylog.start_logging(tmp_path, program=fancylog)
assert (
"`program` is deprecated since 0.6.0 and will be removed in 0.7.0;"
in str(w[0].message)
)
assert "`package` must be passed" in str(e.value)