Skip to content

Commit

Permalink
test for 362
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Oct 21, 2024
1 parent 2ecdcc5 commit 6e7f19d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/test_importdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@


import os
import sys
from shutil import rmtree
from tempfile import NamedTemporaryFile, mkdtemp
from textwrap import dedent
Expand All @@ -15,8 +16,31 @@
from pyflyby._importstmt import Import
from pyflyby._util import EnvVarCtx

from contextlib import contextmanager


if sys.version_info > (3, 11):
from contextlib import chdir

else:

@contextmanager
def chdir(path):
old = os.getcwd()
try:
os.chdir(path)
yield
finally:
os.chdir(old)


def test_importDB_root():
"""
See #362
"""
with chdir("/"):
ImportDB.get_default(None)

def test_ImportDB_from_code_1():
db = ImportDB('from aa.bb import cc as dd, ee')
expected_known = ImportSet(['from aa.bb import cc as dd, ee'])
Expand Down

0 comments on commit 6e7f19d

Please sign in to comment.