From 4c2362b361ea17e1ace0767e40fa5fc64e0927d5 Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Thu, 4 Jan 2024 04:00:09 +0100 Subject: [PATCH] tests: remove import path mangling while importing 'test._common' The import path mangling is not relevant (anymore?) for the two ways of running tests: * `python3 test/testall.py` (see CONTRIBUTING.rst): The `testall.py` script already adds the project path to `sys.path`. * `tox -e py-cov`: this command is supposed to be run from the project path. Thus, the current directory is already the first of location in `sys.path`. The previous mangling of the import path while loading a module could lead to unwanted side-effects hidden in an unexpected location. Instead, import path mangling should take place in the script being called by the user (here: `testall.py`). --- test/_common.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/_common.py b/test/_common.py index 01839e96f..665c9098b 100644 --- a/test/_common.py +++ b/test/_common.py @@ -22,8 +22,6 @@ import time import unittest from contextlib import contextmanager -# Mangle the search path to include the beets sources. -sys.path.insert(0, "..") import beets # noqa: E402 import beets.library # noqa: E402