diff options
author | David Szotten <davidszotten@gmail.com> | 2016-02-03 20:45:36 +0000 |
---|---|---|
committer | David Szotten <davidszotten@gmail.com> | 2016-02-03 20:45:36 +0000 |
commit | bea392d7ed263ceec5d81311a9f116e0fcd4574f (patch) | |
tree | 38017d88104c8cca345fe0040f5b487ca93a3699 /tests/test_main.py | |
parent | cd678d9756c88c2bc27ccde09136b76edadd2920 (diff) |
ensure target dir exists when copying config
Diffstat (limited to 'tests/test_main.py')
-rw-r--r-- | tests/test_main.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/tests/test_main.py b/tests/test_main.py index b01c0393..4a91f541 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -1,11 +1,12 @@ -import pytest +import os import platform + +import pytest try: import setproctitle except ImportError: setproctitle = None -from pgcli.config import config_location from pgcli.main import obfuscate_process_password, format_output, PGCli from utils import dbtest, run @@ -67,9 +68,19 @@ def test_format_output_auto_expand(): def test_i_works(tmpdir, executor): sqlfile = tmpdir.join("test.sql") sqlfile.write("SELECT NOW()") + rcfile = str(tmpdir.join("rcfile")) cli = PGCli( pgexecute=executor, - pgclirc_file=config_location(), + pgclirc_file=rcfile, ) statement = r"\i {}".format(sqlfile) run(executor, statement, pgspecial=cli.pgspecial) + + +def test_missing_rc_dir(tmpdir): + rcfile = str(tmpdir.join("subdir").join("rcfile")) + + cli = PGCli( + pgclirc_file=rcfile, + ) + assert os.path.exists(rcfile) |