Skip to content

Commit

Permalink
Merge pull request #59 from kshivakumar/tc_ffix
Browse files Browse the repository at this point in the history
  • Loading branch information
laike9m authored Feb 7, 2022
2 parents 7b80d1c + d484ff9 commit e138a10
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ coverage.xml
.project
.pydevproject
.idea
.vscode

# Rope
.ropeproject
Expand Down
2 changes: 1 addition & 1 deletion pdir/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from . import format

if platform.system() == 'Windows':
from colorama import init
from colorama import init # type: ignore

init() # To support Windows.

Expand Down
2 changes: 1 addition & 1 deletion pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@ build-backend = "pdm.pep517.api"

[tool.black]
skip-string-normalization = true

[[tool.mypy.overrides]]
module = ["pytest"]
ignore_missing_imports = true
17 changes: 9 additions & 8 deletions tests/test_user_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@

@pytest.fixture
def clean():
DEFAULT_CONFIG_FILE = os.path.join(os.path.expanduser('~'), '.pdir2config')
yield DEFAULT_CONFIG_FILE
if 'PDIR2_CONFIG_FILE' in os.environ:
if os.path.exists(os.environ['PDIR2_CONFIG_FILE']):
os.remove(os.environ['PDIR2_CONFIG_FILE'])
del os.environ['PDIR2_CONFIG_FILE']
if os.path.exists(DEFAULT_CONFIG_FILE):
os.remove(DEFAULT_CONFIG_FILE)
for module in (
'pdir',
'pdir.api',
Expand All @@ -33,6 +25,15 @@ def clean():
del modules[module]
except KeyError:
pass

DEFAULT_CONFIG_FILE = os.path.join(os.path.expanduser('~'), '.pdir2config')
yield DEFAULT_CONFIG_FILE
if 'PDIR2_CONFIG_FILE' in os.environ:
if os.path.exists(os.environ['PDIR2_CONFIG_FILE']):
os.remove(os.environ['PDIR2_CONFIG_FILE'])
del os.environ['PDIR2_CONFIG_FILE']
if os.path.exists(DEFAULT_CONFIG_FILE):
os.remove(DEFAULT_CONFIG_FILE)


def test_default_env_without_config(clean):
Expand Down

0 comments on commit e138a10

Please sign in to comment.