Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed traceback on error when a dir doesn't contain META.json

Closes issue #19.
  • Loading branch information...
commit 744160197765f0a7d3124cad7049461b3f0b7ddf 1 parent f765191
@dvarrazzo authored
View
2  pgxnclient/commands/__init__.py
@@ -384,7 +384,7 @@ def get_meta(self, spec):
logger.debug("reading %s", fn)
if not os.path.exists(fn):
raise PgxnClientException(
- _("file 'META.json' not found in '%s'") % dir)
+ _("file 'META.json' not found in '%s'") % spec.dirname)
with open(fn) as f:
return load_json(f)
View
14 pgxnclient/tests/test_commands.py
@@ -872,6 +872,20 @@ def test_unload_missing(self):
self.assertEquals(self.mock_popen.call_count, 0)
+ def test_missing_meta_dir(self):
+ # issue #19
+ tdir = tempfile.mkdtemp()
+ try:
+ from pgxnclient.zip import unpack
+ dir = unpack(get_test_filename('foobar-0.42.1.zip'), tdir)
+ os.unlink(os.path.join(dir, 'META.json'))
+
+ from pgxnclient.cli import main
+ self.assertRaises(PgxnClientException, main, ['load', dir])
+
+ finally:
+ shutil.rmtree(tdir)
+
class SearchTestCase(unittest.TestCase):
@patch('sys.stdout')
Please sign in to comment.
Something went wrong with that request. Please try again.