pimutils / vdirsyncer

📇 Synchronize calendars and contacts.
https://vdirsyncer.pimutils.org/
Other
1.53k stars 160 forks source link

test_entry_points test fails if vdirsyncer is not yet installed #393

Closed WhyNotHugo closed 8 years ago

WhyNotHugo commented 8 years ago

test_entry_points test fails without installing vdirsyncer - but we run tests while packaging before installation (and, IIRC; the whole point of that test was for packagers to test everything).

running build
running build_py
running egg_info
writing entry points to vdirsyncer.egg-info/entry_points.txt
writing requirements to vdirsyncer.egg-info/requires.txt
writing top-level names to vdirsyncer.egg-info/top_level.txt
writing dependency_links to vdirsyncer.egg-info/dependency_links.txt
writing vdirsyncer.egg-info/PKG-INFO
reading manifest file 'vdirsyncer.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'docs/_build'
warning: no previously-included files matching '__pycache__' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
warning: no previously-included files matching '*.pyd' found anywhere in distribution
writing manifest file 'vdirsyncer.egg-info/SOURCES.txt'
==> Starting check()...
set -e; \
if [ "false" = "true" ]; then \
        coverage run --source=vdirsyncer/ --module pytest; \
        codecov; \
else \
        py.test; \
fi
====================================================== test session starts =======================================================
platform linux -- Python 3.5.1, pytest-2.9.0, py-1.4.31, pluggy-0.3.1
rootdir: /home/hugo/workspace/Arch/vdirsyncer/src/vdirsyncer-0.9.2, inifile: setup.cfg
plugins: localserver-0.3.4, hypothesis-3.1.0, subtesthack-0.1.1
collected 430 items

test-requirements.txt s
tests/test_metasync.py ......
tests/test_sync.py .......................
tests/cli/test_config.py ........
tests/cli/test_discover.py .
tests/cli/test_fetchparams.py ..........
tests/cli/test_main.py F.............
tests/cli/test_repair.py ...
tests/cli/test_utils.py .
tests/storage/test_filesystem.py ...........................................sss...........
tests/storage/test_http.py ......
tests/storage/test_http_with_singlefile.py ......................................sssss...sssss
tests/storage/test_memory.py ......................................sssss...sss..
tests/storage/test_remotestorage.py sssssssssssssssssssssssssssssssssssssssssssssssssssssssss
tests/storage/test_singlefile.py ......................................ssss...sssss.
tests/storage/dav/test_caldav.py ssssssssssssssssssssssssssssssssssssssssssssssssss
tests/storage/dav/test_carddav.py ssssssssssssssssssssssss
tests/storage/dav/test_utils.py .
tests/utils/test_main.py ......
tests/utils/test_vobject.py .........

============================================================ FAILURES ============================================================
_______________________________________________________ test_entry_points ________________________________________________________

monkeypatch = <_pytest.monkeypatch.monkeypatch object at 0x7f4ed5441c50>
capsys = <_pytest.capture.CaptureFixture object at 0x7f4ed54419e8>

    def test_entry_points(monkeypatch, capsys):
        monkeypatch.setattr('sys.argv', ['--help'])
        with pytest.raises(SystemExit) as excinfo:
>           load_entry_point('vdirsyncer', 'console_scripts', 'vdirsyncer')()

tests/cli/test_main.py:23:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.5/site-packages/pkg_resources/__init__.py:549: in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
/usr/lib/python3.5/site-packages/pkg_resources/__init__.py:542: in get_distribution
    dist = get_provider(dist)
/usr/lib/python3.5/site-packages/pkg_resources/__init__.py:422: in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
/usr/lib/python3.5/site-packages/pkg_resources/__init__.py:943: in require
    needed = self.resolve(parse_requirements(requirements))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <pkg_resources.WorkingSet object at 0x7f4ed9b034e0>, requirements = []
env = <pkg_resources.Environment object at 0x7f4ed53e8be0>, installer = None, replace_conflicting = False

    def resolve(self, requirements, env=None, installer=None,
            replace_conflicting=False):
        """List all distributions needed to (recursively) meet `requirements`

            `requirements` must be a sequence of ``Requirement`` objects.  `env`,
            if supplied, should be an ``Environment`` instance.  If
            not supplied, it defaults to all distributions available within any
            entry or distribution in the working set.  `installer`, if supplied,
            will be invoked with each requirement that cannot be met by an
            already-installed distribution; it should return a ``Distribution`` or
            ``None``.

            Unless `replace_conflicting=True`, raises a VersionConflict exception if
            any requirements are found on the path that have the correct name but
            the wrong version.  Otherwise, if an `installer` is supplied it will be
            invoked to obtain the correct version of the requirement and activate
            it.
            """

        # set up the stack
        requirements = list(requirements)[::-1]
        # set of processed requirements
        processed = {}
        # key -> dist
        best = {}
        to_activate = []

        # Mapping of requirement to set of distributions that required it;
        # useful for reporting info about conflicts.
        required_by = collections.defaultdict(set)

        while requirements:
            # process dependencies breadth-first
            req = requirements.pop(0)
            if req in processed:
                # Ignore cyclic or redundant dependencies
                continue
            dist = best.get(req.key)
            if dist is None:
                # Find the best distribution and add it to the map
                dist = self.by_key.get(req.key)
                if dist is None or (dist not in req and replace_conflicting):
                    ws = self
                    if env is None:
                        if dist is None:
                            env = Environment(self.entries)
                        else:
                            # Use an empty environment and workingset to avoid
                            # any further conflicts with the conflicting
                            # distribution
                            env = Environment([])
                            ws = WorkingSet([])
                    dist = best[req.key] = env.best_match(req, ws, installer)
                    if dist is None:
                        requirers = required_by.get(req, None)
>                       raise DistributionNotFound(req, requirers)
E                       pkg_resources.DistributionNotFound: The 'vdirsyncer' distribution was not found and is required by the application

/usr/lib/python3.5/site-packages/pkg_resources/__init__.py:830: DistributionNotFound
======================================= 1 failed, 267 passed, 162 skipped in 8.43 seconds ========================================
Makefile:31: recipe for target 'test' failed
make: *** [test] Error 1

I only realized this after it was reported by others - it did not initially fail for me, because I already had a former version installed.

untitaker commented 8 years ago

Isn't the point of packaging tests to also test that the installation works correctly in the given environment?

On 22 March 2016 15:03:51 CET, Hugo Osvaldo Barrera notifications@github.com wrote:

test_entry_points test fails without installing vdirsyncer - but we run tests while packaging before installation (and, IIRC; the whole point of that test was for packagers to test everything).

running build
running build_py
running egg_info
writing entry points to vdirsyncer.egg-info/entry_points.txt
writing requirements to vdirsyncer.egg-info/requires.txt
writing top-level names to vdirsyncer.egg-info/top_level.txt
writing dependency_links to vdirsyncer.egg-info/dependency_links.txt
writing vdirsyncer.egg-info/PKG-INFO
reading manifest file 'vdirsyncer.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'docs/_build'
warning: no previously-included files matching '__pycache__' found
anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in
distribution
warning: no previously-included files matching '*.pyd' found anywhere
in distribution
writing manifest file 'vdirsyncer.egg-info/SOURCES.txt'
==> Starting check()...
set -e; \
if [ "false" = "true" ]; then \
       coverage run --source=vdirsyncer/ --module pytest; \
       codecov; \
else \
       py.test; \
fi
====================================================== test session
starts =======================================================
platform linux -- Python 3.5.1, pytest-2.9.0, py-1.4.31, pluggy-0.3.1
rootdir: /home/hugo/workspace/Arch/vdirsyncer/src/vdirsyncer-0.9.2,
inifile: setup.cfg
plugins: localserver-0.3.4, hypothesis-3.1.0, subtesthack-0.1.1
collected 430 items

test-requirements.txt s
tests/test_metasync.py ......
tests/test_sync.py .......................
tests/cli/test_config.py ........
tests/cli/test_discover.py .
tests/cli/test_fetchparams.py ..........
tests/cli/test_main.py F.............
tests/cli/test_repair.py ...
tests/cli/test_utils.py .
tests/storage/test_filesystem.py
...........................................sss...........
tests/storage/test_http.py ......
tests/storage/test_http_with_singlefile.py
......................................sssss...sssss
tests/storage/test_memory.py
......................................sssss...sss..
tests/storage/test_remotestorage.py
sssssssssssssssssssssssssssssssssssssssssssssssssssssssss
tests/storage/test_singlefile.py
......................................ssss...sssss.
tests/storage/dav/test_caldav.py
ssssssssssssssssssssssssssssssssssssssssssssssssss
tests/storage/dav/test_carddav.py ssssssssssssssssssssssss
tests/storage/dav/test_utils.py .
tests/utils/test_main.py ......
tests/utils/test_vobject.py .........

============================================================ FAILURES
============================================================
_______________________________________________________
test_entry_points
________________________________________________________

monkeypatch = <_pytest.monkeypatch.monkeypatch object at
0x7f4ed5441c50>
capsys = <_pytest.capture.CaptureFixture object at 0x7f4ed54419e8>

   def test_entry_points(monkeypatch, capsys):
       monkeypatch.setattr('sys.argv', ['--help'])
       with pytest.raises(SystemExit) as excinfo:
>           load_entry_point('vdirsyncer', 'console_scripts',
'vdirsyncer')()

tests/cli/test_main.py:23:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.5/site-packages/pkg_resources/__init__.py:549: in
load_entry_point
   return get_distribution(dist).load_entry_point(group, name)
/usr/lib/python3.5/site-packages/pkg_resources/__init__.py:542: in
get_distribution
   dist = get_provider(dist)
/usr/lib/python3.5/site-packages/pkg_resources/__init__.py:422: in
get_provider
  return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
/usr/lib/python3.5/site-packages/pkg_resources/__init__.py:943: in
require
   needed = self.resolve(parse_requirements(requirements))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <pkg_resources.WorkingSet object at 0x7f4ed9b034e0>,
requirements = []
env = <pkg_resources.Environment object at 0x7f4ed53e8be0>, installer =
None, replace_conflicting = False

   def resolve(self, requirements, env=None, installer=None,
           replace_conflicting=False):
 """List all distributions needed to (recursively) meet `requirements`

 `requirements` must be a sequence of ``Requirement`` objects.  `env`,
           if supplied, should be an ``Environment`` instance.  If
   not supplied, it defaults to all distributions available within any
  entry or distribution in the working set.  `installer`, if supplied,
        will be invoked with each requirement that cannot be met by an
already-installed distribution; it should return a ``Distribution`` or
           ``None``.

Unless `replace_conflicting=True`, raises a VersionConflict exception
if
 any requirements are found on the path that have the correct name but
the wrong version.  Otherwise, if an `installer` is supplied it will be
 invoked to obtain the correct version of the requirement and activate
           it.
           """

       # set up the stack
       requirements = list(requirements)[::-1]
       # set of processed requirements
       processed = {}
       # key -> dist
       best = {}
       to_activate = []

    # Mapping of requirement to set of distributions that required it;
       # useful for reporting info about conflicts.
       required_by = collections.defaultdict(set)

       while requirements:
           # process dependencies breadth-first
           req = requirements.pop(0)
           if req in processed:
               # Ignore cyclic or redundant dependencies
               continue
           dist = best.get(req.key)
           if dist is None:
               # Find the best distribution and add it to the map
               dist = self.by_key.get(req.key)
         if dist is None or (dist not in req and replace_conflicting):
                   ws = self
                   if env is None:
                       if dist is None:
                           env = Environment(self.entries)
                       else:
                    # Use an empty environment and workingset to avoid
                          # any further conflicts with the conflicting
                           # distribution
                           env = Environment([])
                           ws = WorkingSet([])
             dist = best[req.key] = env.best_match(req, ws, installer)
                   if dist is None:
                       requirers = required_by.get(req, None)
>                       raise DistributionNotFound(req, requirers)
E                       pkg_resources.DistributionNotFound: The
'vdirsyncer' distribution was not found and is required by the
application

/usr/lib/python3.5/site-packages/pkg_resources/__init__.py:830:
DistributionNotFound
======================================= 1 failed, 267 passed, 162
skipped in 8.43 seconds ========================================
Makefile:31: recipe for target 'test' failed
make: *** [test] Error 1

I only realized this after it was reported by others - it did not initially fail for me, because I already had a former version installed.


You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/pimutils/vdirsyncer/issues/393

Sent from my Android device with K-9 Mail. Please excuse my brevity.

untitaker commented 8 years ago

This bugreport seemingly originated from https://aur.archlinux.org/packages/vdirsyncer/, but I can build, install and check vdirsyncer without any problems.

WhyNotHugo commented 8 years ago

Can you also do that if you uninstall your local copy of vdirsyncer?

untitaker commented 8 years ago

Yes. (I don't actually have vdirsyncer installed globally, I just symlink the binary from the development virtualenv into my PATH).

WhyNotHugo commented 8 years ago

That's odd (FWIW, I can reproduce the issue, I didn't just copy-paste a third party's report).

untitaker commented 8 years ago

Fixed in master. Commit message:

I thought it was common practice to run testsuites post-install. Apparently this isn't the case with Archlinux, which executes check between build and install.

untitaker commented 8 years ago

Released 0.9.3.

WhyNotHugo commented 8 years ago

Actually, Arch runs check post-package. The packager and installer may not be the same person, or machine. This is what happens when packages in the official repositories.

untitaker commented 8 years ago

When I had check enabled in the makepkg.conf, I've never run a check for a package I didn't have to build myself.