From dbd1a2f9c4380ad6616872ac9a44e534c3164f46 Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Tue, 5 Dec 2023 09:34:34 +0100 Subject: [PATCH] fix test --- tests/test_cmdline.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index cc46eb8d..74271047 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -13,7 +13,7 @@ import tempfile from textwrap import dedent -from pyflyby._util import EnvVarCtx +from pyflyby._util import EnvVarCtx, CwdCtx import pytest @@ -790,23 +790,23 @@ class B: from foo import A, B """).lstrip()) dot_pyflyby_fp.flush() + with CwdCtx(temp_dir): + result = pipe( + [BIN_DIR + "/tidy-imports", foo_fp.name], + env={"PYFLYBY_PATH": dot_pyflyby}, + ) + + expected = dedent( + """ + from __future__ import annotations - os.chdir(temp_dir) - result = pipe([ - BIN_DIR+"/tidy-imports", foo_fp.name - ], env={ - "PYFLYBY_PATH": dot_pyflyby - }) - - expected = dedent(""" - from __future__ import annotations - - class A: - param1: str - param2: B + class A: + param1: str + param2: B - class B: - param1: str - """).strip() + class B: + param1: str + """ + ).strip() assert result == expected