Skip to content

Commit 0fdd02e

Browse files
committed
Change __name__ to MDAnalysis fix tests
1 parent 74bcc03 commit 0fdd02e

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

package/MDAnalysis/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@
200200
from .lib import log
201201
from .lib.log import start_logging, stop_logging
202202

203-
logging.getLogger(__name__).addHandler(logging.NullHandler())
203+
logging.getLogger("MDAnalysis").addHandler(logging.NullHandler())
204204
del logging
205205

206206
# only MDAnalysis DeprecationWarnings are loud by default

package/MDAnalysis/lib/log.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def start_logging(stream="MDAnalysis.log", version=version.__version__):
126126

127127
def stop_logging():
128128
"""Stop logging to logfile and console."""
129-
logger = logging.getLogger(__name__)
129+
logger = logging.getLogger("MDAnalysis")
130130
logger.info("MDAnalysis STOPPED logging")
131131
clear_handlers(logger) # this _should_ do the job...
132132

testsuite/MDAnalysisTests/lib/test_log.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
class TestConvenienceFunctions:
3333
def test_start_logging(self, tmp_path):
3434
mda.start_logging(tmp_path / "MDAnalysis.log")
35-
logger = logging.getLogger(__name__)
35+
logger = logging.getLogger("MDAnalysis")
3636

3737
# Test expected handlers' presence and behavior
3838
assert any(isinstance(h, logging.NullHandler) for h in logger.handlers)
@@ -51,7 +51,7 @@ def test_start_logging(self, tmp_path):
5151

5252
def test_stop_logging(self, tmp_path):
5353
mda.lib.log.start_logging(tmp_path / "MDAnalysis.log")
54-
logger = logging.getLogger(__name__)
54+
logger = logging.getLogger("MDAnalysis")
5555
mda.lib.log.stop_logging()
5656

5757
assert len(logger.handlers) == 0

0 commit comments

Comments
 (0)