Hi Florian,

I have this problem as well and was trying to find a better solution before
bringing up this issue, but let me share my solution so far.

The problem is that the mechanism for plugin discovered used by pytest
(setupttools entry points) doesn't work with frozen executables so pytest
can't find any plugins.

The workaround I currently use is to add this to my `conftest.py`:

def pytest_configure(config):
    # Manually import pytest-qt because disutils cannot find it on its own
when running tests inside
    # an executable.
    if getattr(sys, 'frozen', False):
        import pytestqt.plugin
        config.pluginmanager.register(pytestqt.plugin, 'pytest-qt')
        # and any other plugins

Another solution would be to explicitly pass the plugin in the command line
using `-p pytestq.plugin`.

I still would like for this to work out of the box somehow though, so if
anyone has any suggestions/ideas they are welcome.


On Thu, Jun 18, 2015 at 6:28 AM Florian Bruhin <m...@the-compiler.org> wrote:

> Hi,
>
> I'm currently trying to run my tests with my application frozen via
> cx_Freeze.
>
> To do so, I wrote a separate script to freeze the tests into a
> separate executable, which uses pytest.freeze_includes():
>
>
> https://github.com/The-Compiler/qutebrowser/blob/frozen-tests/scripts/freeze_tests.py
>
> https://github.com/The-Compiler/qutebrowser/blob/frozen-tests/scripts/run_frozen_tests.py
>
> Apart of some issues with importing distutils (which I haven't looked
> into yet), it seems pytest doesn't find the qapp fixture which is
> provided by pytest-qt:
>
> http://paste.the-compiler.org/view/7b1dbbf2
>
> Is there something I can do to make cx_Freeze freeze those plugins as
> well, or to make pytest recognize them when frozen?
>
> I tried adding pytestqt to includes=[...], but that didn't help
> either.
>
> Florian
>
> --
> http://www.the-compiler.org | m...@the-compiler.org (Mail/XMPP)
>    GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc
>          I love long mails! | http://email.is-not-s.ms/
> _______________________________________________
> pytest-dev mailing list
> pytest-dev@python.org
> https://mail.python.org/mailman/listinfo/pytest-dev
>
_______________________________________________
pytest-dev mailing list
pytest-dev@python.org
https://mail.python.org/mailman/listinfo/pytest-dev

Reply via email to