Skip to content

Commit

Permalink
Fix a brown paper bug in the last release (sorry!)
Browse files Browse the repository at this point in the history
  • Loading branch information
osantana committed Aug 17, 2015
1 parent 5f4855b commit f14e73c
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 26 deletions.
7 changes: 7 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
1.1.1
=====

- Fix a brown paper bug in the last release
- Force test running in ``make release`` target
- Add "pragma: no cover" in abstract methods

1.1.0
=====

Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ test:
python setup.py test

clean:
find . -iname "*.py[ocd]" -delete
find . -iname "__pycache__" -exec rm -rf {} \;
rm -rf dist
@find . -iname "*.py[ocd]" -delete
@find . -iname "__pycache__" -exec rm -rf {} \;
@rm -rf dist

release:
release: clean test
git tag `python setup.py -q version`
git push origin `python setup.py -q version`
python setup.py sdist upload
2 changes: 1 addition & 1 deletion prettyconf/casts.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class AbstractCast(object):
def __call__(self, value):
raise NotImplementedError()
raise NotImplementedError() # pragma: no cover


class Boolean(AbstractCast):
Expand Down
10 changes: 4 additions & 6 deletions prettyconf/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,11 @@ def _discover(self):
self._config_files = []

path = self.starting_path
while True:
if not os.path.isdir(path):
continue

self._config_files += self._scan_path(path)
while not self._config_files:
if os.path.isdir(path):
self._config_files += self._scan_path(path)

if self._config_files or path == self.root_path or path == os.path.sep:
if path == self.root_path:
break

path = os.path.dirname(path)
Expand Down
9 changes: 5 additions & 4 deletions prettyconf/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

class AbstractConfigurationLoader(object):
def __contains__(self, item):
raise NotImplementedError()
raise NotImplementedError() # pragma: no cover

def __getitem__(self, item):
raise NotImplementedError()
raise NotImplementedError() # pragma: no cover


class EnvVarConfigurationLoader(AbstractConfigurationLoader):
Expand All @@ -39,10 +39,10 @@ def get_filenames(cls, path):
return filenames

def __getitem__(self, item):
raise NotImplementedError()
raise NotImplementedError() # pragma: no cover

def __contains__(self, item):
raise NotImplementedError()
raise NotImplementedError() # pragma: no cover


class EnvFileConfigurationLoader(AbstractFileConfigurationLoader):
Expand Down Expand Up @@ -157,6 +157,7 @@ def __init__(self, filename, section=None):
try:
if sys.version_info[0] < 3:
# ConfigParser.readfp is deprecated for Python3, read_file replaces it
# noinspection PyDeprecation
self.parser.readfp(inifile)
else:
self.parser.read_file(inifile)
Expand Down
11 changes: 0 additions & 11 deletions tests/test_filediscover.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,6 @@ def test_config_file_parsing(self):
discovery = ConfigurationDiscovery(os.path.dirname(self.test_files_path))
self.assertEqual(len(discovery.config_files), 2) # 2 *valid* files created

def test_abort_discovery_from_invalid_path(self):
self._create_file(self.test_files_path + '/.env')
with self.assertRaises(InvalidPath):
# filename is not a valid starting path...
ConfigurationDiscovery(self.test_files_path + "/.env").config_files

def test_abort_discovery_with_non_existing_path(self):
with self.assertRaises(InvalidPath):
# ... and missing path either
ConfigurationDiscovery(self.test_files_path + "/missing").config_files

def test_should_not_look_for_parent_directory_when_it_finds_valid_configurations(self):
self._create_file(self.test_files_path + '/../../settings.ini', '[settings]')
self._create_file(self.test_files_path + '/../../.env')
Expand Down

0 comments on commit f14e73c

Please sign in to comment.