Commit 786ff489 authored by Chris Lamb's avatar Chris Lamb 👀
Browse files

Rename diffoscope.locale module to diffoscope.environ as we are modifying...

Rename diffoscope.locale module to diffoscope.environ as we are modifying things beyond just the locale (eg. calling tzset(), etc.)
parent 600831ba
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -24,10 +24,10 @@ import logging
logger = logging.getLogger(__name__)


def set_locale():
def normalize_environment():
    """
    Normalise locale so external tool gives us stable and properly encoded
    output.
    Normalise locale, etc. so external tools give us stable and properly
    encoded output.
    """

    logger.debug(
+2 −2
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ from .tools import (
    get_current_os,
)
from .config import Config
from .locale import set_locale
from .environ import normalize_environment
from .logging import line_eraser, setup_logging
from .progress import ProgressManager, Progress
from .profiling import ProfileManager, profile
@@ -660,7 +660,7 @@ def run_diffoscope(parsed_args):
        *"ar as ld ld.bfd nm objcopy objdump ranlib readelf strip".split(),
    )
    set_path()
    set_locale()
    normalize_environment()
    path1, path2 = parsed_args.path1, parsed_args.path2
    if path2 is None:
        if path1 == '-':
+4 −4
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@
import pytest

from diffoscope.path import set_path
from diffoscope.locale import set_locale
from diffoscope.environ import normalize_environment
from diffoscope.progress import ProgressManager
from diffoscope.comparators import ComparatorManager

@@ -32,9 +32,9 @@ def pytest_configure(config):


@pytest.fixture(autouse=True, scope='session')
def locale():
    # Ensure set_locale fixture runs before each test.
    set_locale()
def environ():
    # Ensure normalize_environment fixture runs before each test.
    normalize_environment()


@pytest.fixture(autouse=True)