Skip to content

Commit 6bfd460

Browse files
authored
Merge pull request #74 from pytest-dev/mute_locale_warning
Mute deprecation warning of getdefaultlocale until a better solution
2 parents 0f7831c + 9e645c4 commit 6bfd460

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pytest_nunit/nunit.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import platform
55
import sys
6+
import warnings
67

78
from _pytest._code.code import ExceptionChainRepr
89

@@ -116,7 +117,11 @@ def _format_filters(filters_):
116117

117118

118119
def _getlocale():
119-
language_code = locale.getdefaultlocale()[0]
120+
# See https://github.com/pytest-dev/pytest-nunit/pull/73
121+
with warnings.catch_warnings():
122+
warnings.simplefilter("ignore")
123+
language_code = locale.getdefaultlocale()[0]
124+
120125
if language_code:
121126
return language_code
122127
return "en-US"

0 commit comments

Comments
 (0)