QLands
QLands

Reputation: 2586

Pyramid WebTest not catching ContextualVersionConflict

I have a pyramid 1.10 that I start with pserve. When I start the application it crashes with

File "/home/cquiros/data/projects2017/personal/software/env_formshare/lib/python3.6/site-packages/pkg_resources/__init__.py", line 783, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (protobuf 3.11.3 (/home/cquiros/data/projects2017/personal/software/env_formshare/lib/python3.6/site-packages), Requirement.parse('protobuf==3.6.1'), {'mysql-connector-python'})

However if I run the WebTest checks with this code no error is reported:

class FunctionalTests(unittest.TestCase):
    def setUp(self):
        from .config import server_config
        from formshare import main
        app = main(None, **server_config)
        from webtest import TestApp
        self.testapp = TestApp(app)

I can see that TestApp uses paste.deploy.loadapp so why the test does not report the ContextualVersionConflict error?

Upvotes: 0

Views: 63

Answers (1)

QLands
QLands

Reputation: 2586

I just added pkg_resources.require("my_app") to the tests to catch it.

Upvotes: 0

Related Questions