Merge lp:~james-w/pkgme/further-test-fixes into lp:pkgme
Proposed by
James Westby
Status: | Merged |
---|---|
Approved by: | Barry Warsaw |
Approved revision: | 44 |
Merged at revision: | 47 |
Proposed branch: | lp:~james-w/pkgme/further-test-fixes |
Merge into: | lp:pkgme |
Prerequisite: | lp:~james-w/pkgme/add-docs |
Diff against target: |
116 lines (+36/-16) 3 files modified
pkgme/backend.py (+15/-6) pkgme/project_info.py (+19/-8) pkgme/tests/test_vala_backend.py (+2/-2) |
To merge this branch: | bzr merge lp:~james-w/pkgme/further-test-fixes |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Barry Warsaw (community) | Approve | ||
Review via email: mp+46419@code.launchpad.net |
Description of the change
Hi,
Here are some further improvements that prevented me from running
some of the tests, or helped me diagnose those problems.
Thanks,
James
To post a comment you must log in.
review approve
merge approve
=== modified file 'pkgme/backend.py' dir(underunder_ file, backend): abspath( os.path. normpath(
--- pkgme/backend.py 2010-12-18 14:55:00 +0000
+++ pkgme/backend.py 2011-01-16 19:09:53 +0000
> @@ -1,3 +1,4 @@
> +import errno
> import os
> import sys
> import subprocess
> @@ -16,10 +17,10 @@
>
>
> def get_backend_
> - backend_dir = os.path.normpath(
> + backend_dir = os.path.
Only abspath() should be necessary, as it calls normpath() on its return posixpath. py.
value. See Python's Lib/os/
> os.path.join( dirname( underunder_ file), os.pardir, {platform} -{version} directory and that cannot be used as a join(self. basepath, self.WANT_ SCRIPT_ NAME) abspath( self.basepath) , self.WANT_ SCRIPT_ NAME) exists( script_ path): subprocess. PIPE, subprocess. STDOUT, stdin=subproces s.PIPE, subprocess. PIPE, subprocess. STDOUT, stdin=subproces s.PIPE,
> os.path.
> - 'backends', backend))
> + 'backends', backend)))
> # When 'python setup.py test' is run with virtualenv, backend_dir will not
> # point to the right place. It will point into the
> # build/lib.
> @@ -114,12 +115,19 @@
> self.basepath = basepath
>
> def want(self, path):
> - script_path = os.path.
> + script_path = os.path.join(
> + os.path.
> if os.path.
> - proc = subprocess.Popen(
> - [script_path], stdout=
> - stderr=
> - cwd=path)
> + try:
> + proc = subprocess.Popen(
> + [script_path], stdout=
> + stderr=
> + cwd=path)
> + except OSError, e:
Probably should use "except OSError as e" for forward compatibility. (We only
have to support >=Python 2.6, right?)
> + if e.errno == errno.ENOENT: ailed( abspath( path) isdir(path) :
> + raise ExternalHelperF
> + "%s does not exist" % script_path)
> + raise
> out, ignore = proc.communicate()
> if proc.returncode != 0:
> # TODO: some info on the failure
> @@ -216,6 +224,7 @@
> backends = []
> names = set()
> for path in self.paths:
> + path = os.path.
> if not os.path.
> continue
> fnames = os.listdir(path)
=== modified file 'pkgme/ project_ info.py' info.py 2010-11-10 00:44:43 +0000 info.py 2011-01-16 19:09:53 +0000 join(self. basepath, self.INFO_ SCRIPT_ NAME) exists( script_ path): subprocess. PIPE, subprocess. STDOUT, stdin=subproces s.PIPE, subprocess. PIPE, subprocess. STDOUT, stdin=subproces s.PI...
--- pkgme/project_
+++ pkgme/project_
> @@ -1,3 +1,4 @@
> +import errno
> import json
> import os
> import subprocess
> @@ -40,10 +41,15 @@
> def get_all(self, keys):
> script_path = os.path.
> if os.path.
> - proc = subprocess.Popen(
> - [script_path], stdout=
> - stderr=
> - cwd=self.cwd)
> + try:
> + proc = subprocess.Popen(
> + [script_path], stdout=
> + stderr=