Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/configobj/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,7 @@ def _load(self, infile, configspec):

if isinstance(infile, six.string_types):
self.filename = infile
if os.path.isfile(infile):
if os.path.exists(infile) and not os.path.isdir(infile):
with open(infile, 'rb') as h:
content = h.readlines() or []
elif self.file_error:
Expand Down
4 changes: 4 additions & 0 deletions src/tests/conf_envsubst.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import sys
import configobj

print(configobj.ConfigObj(sys.argv[1]))
4 changes: 4 additions & 0 deletions src/tests/envsubst.ini.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Template test

shell = ${SHELL}

18 changes: 18 additions & 0 deletions src/tests/test_validate_envsubst.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# *- coding: utf-8 -*-
# pylint: disable=wildcard-import, missing-docstring, no-self-use, bad-continuation
# pylint: disable=invalid-name, redefined-outer-name, too-few-public-methods

import os

import pytest
import subprocess

@pytest.fixture()
def thisdir():
return os.path.dirname(os.path.join(os.getcwd(), __file__))


def test_validate_template(thisdir,capsys):
templatepath = os.path.join(thisdir, 'envsubst.ini.template')
out = subprocess.check_output(["bash","-c","export SHELL=/bin/bash && python %s/conf_envsubst.py <(envsubst < %s)"%(thisdir,templatepath)])
assert out.decode() == "{'shell': '/bin/bash'}\n"