Skip to content

pip install'ed mock should not depend on command-line tools #314

@dimaqq

Description

@dimaqq

I've installed nose and mock into a chroot with some custom code and libraries.

i got following error when running nose:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/local/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/local/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/py_pkg/custom_src/test/test_something_custom.py", line 20, in <module>
    from mock import patch
  File "/usr/local/lib/python2.7/site-packages/mock/__init__.py", line 2, in <module>
    import mock.mock as _mock
  File "/usr/local/lib/python2.7/site-packages/mock/mock.py", line 71, in <module>
    _v = VersionInfo('mock').semantic_version()
  File "/usr/local/lib/python2.7/site-packages/pbr/version.py", line 452, in semantic_version
    self._semantic = self._get_version_from_pkg_resources()
  File "/usr/local/lib/python2.7/site-packages/pbr/version.py", line 439, in _get_version_from_pkg_resources
    result_string = packaging.get_version(self.package)
  File "/usr/local/lib/python2.7/site-packages/pbr/packaging.py", line 640, in get_version
    raise Exception("Versioning for this project requires either an sdist"
Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. Are you sure that git is installed?

It appears that mock brought in pbr dependency and that wants to examine something at runtime.

Perhaps a packaging kludge is needed (sdist in the error).

Or just remove it entirely when installing a fixed version from pypi.

Python-2.7.10
nose=1.3.7
mock install: Successfully installed funcsigs-0.4 mock-1.3.0 pbr-1.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions