Skip to content

Commit

Permalink
Remove obsolete test log level environment variable (#1231)
Browse files Browse the repository at this point in the history
#### Reference Issues/PRs

#### What does this implement or fix?
Remove `ARCTICC_TEST_LOG_LEVEL` in favor of the standard
`ARCTICDB_<stream>_loglevel`. The former is a legacy and is not
documented.
#### Any other comments?

#### Checklist

<details>
  <summary>
   Checklist for code changes...
  </summary>
 
- [ ] Have you updated the relevant docstrings, documentation and
copyright notice?
- [ ] Is this contribution tested against [all ArcticDB's
features](../docs/mkdocs/docs/technical/contributing.md)?
- [ ] Do all exceptions introduced raise appropriate [error
messages](https://docs.arcticdb.io/error_messages/)?
 - [ ] Are API changes highlighted in the PR description?
- [ ] Is the PR labelled as enhancement or bug so it appears in
autogenerated release notes?
</details>

<!--
Thanks for contributing a Pull Request to ArcticDB! Please ensure you
have taken a look at:
- ArcticDB's Code of Conduct:
https://github.com/man-group/ArcticDB/blob/master/CODE_OF_CONDUCT.md
- ArcticDB's Contribution Licensing:
https://github.com/man-group/ArcticDB/blob/master/docs/mkdocs/docs/technical/contributing.md#contribution-licensing
-->

---------

Co-authored-by: Vasil Pashov <[email protected]>
  • Loading branch information
vasil-pashov and Vasil Pashov authored Jan 15, 2024
1 parent 4994238 commit 67c0592
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 48 deletions.
45 changes: 0 additions & 45 deletions python/arcticdb/util/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,42 +58,6 @@ def wrapper(*args, **kwargs):
assert_series_equal = maybe_not_check_freq(pd.testing.assert_series_equal)


def configure_console_logger(level="INFO"):
get_test_logger_config(level)


def get_test_logger_config(level: str = "INFO", outputs: Optional[Iterable[str]] = None) -> LoggersConfig:
"""
outputs controls where log output is directed:
- file - writes log files in "~/.arctic/native"
- console - log to stderr and stdout
For example outputs=["file"], outputs=["file", "console"]
"""
if outputs is None:
outputs = ("console",)

log_cfgs = LoggersConfig()

for o in outputs:
sink = log_cfgs.sink_by_id[o]
if o == "console":
sink.console.std_err = True
elif o == "file":
sink.daily_file.path = os.path.join(Defaults.LOG_DIR, "arcticc.daily.test.log")
else:
raise RuntimeError(f"Unexpected logger output {o}")

for n in logger_by_name.keys():
logger = log_cfgs.logger_by_id[n]
for o in outputs:
logger.sink_ids.append(o)
logger.level = getattr(LoggerConfig, level)
logger.pattern = "%Y%m%d %H:%M:%S.%f %t %L %n | %v".format("arcticc.{}".format(n) if n != "root" else "arcticc")

return log_cfgs


def random_string(length: int):
return "".join(random.choice(string.ascii_uppercase + string.digits) for _ in range(length))

Expand Down Expand Up @@ -180,15 +144,6 @@ def param_dict(fields, cases=None, xfail=None):
return pytest.mark.parametrize(fields, params, ids=ids)


def configure_test_logger(level="INFO"):
level = os.getenv("ARCTICC_TEST_LOG_LEVEL", level)
if os.getenv("ARCTICC_TEST_FILE_LOGGING"):
outputs = ["file", "console"]
else:
outputs = ["console"]
configure(get_test_logger_config(level=level, outputs=outputs), force=True)


CustomThing = NamedTuple(
"CustomThing",
[
Expand Down
4 changes: 1 addition & 3 deletions python/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from arcticdb.storage_fixtures.mongo import auto_detect_server
from arcticdb.storage_fixtures.in_memory import InMemoryStorageFixture
from arcticdb.version_store._normalization import MsgPackNormalizer
from arcticdb.util.test import configure_test_logger, create_df
from arcticdb.util.test import create_df
from tests.util.mark import (
AZURE_TESTS_MARK,
MONGO_TESTS_MARK,
Expand All @@ -40,8 +40,6 @@

hypothesis.settings.load_profile(os.environ.get("HYPOTHESIS_PROFILE", "dev"))

configure_test_logger()

# Use a smaller memory mapped limit for all tests
MsgPackNormalizer.MMAP_DEFAULT_SIZE = 20 * (1 << 20)

Expand Down

0 comments on commit 67c0592

Please sign in to comment.