New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testserver: add support for custom fixtures. #5357

Merged
merged 2 commits into from Feb 8, 2019

Conversation

Projects
None yet
3 participants
@jone
Copy link
Member

jone commented Feb 8, 2019

The testserver is useful for testing other projects which use / work
with a GEVER.
Those projects have specific needs: they may need certain content or a specific structure and may not need some parts of GEVER at all.

Thats why we want to be able to inject a custom fixture when starting up the testserver. We need to be able to subclass the default fixture though, so that we can profit from the features in the default fixture.

The custom fixture can be inserted by setting the FIXTURE environment variable to the path to the fixture python file. The directory of the file needs to be a package, so there needs to be a __init__.py. Since the fixture is stored and maintained in the third party project, it is not part of the python path. The testserver loads the package of the fixture file under the name customfixture, so that importing from gever as well as from this directory works well.

The fixture is changed so that the content creation is moved into a separate method for easier subclassing and changing. We do not want to repeat the init code.

Testserver: add support for custom fixtures.
The testserver is useful for testing other projects which use / work
with a GEVER.
Those projects have specific needs: they may need certain content or a
specific structure and may not need some parts of GEVER at all.

Thats why we want to be able to inject a custom fixture when starting
up the testserver.
We need to be able to subclass the default fixture though, so that we
can profit from the features in the default fixture.

The custom fixture can be inserted by setting the ``FIXTURE``
environment variable to the path to the fixture python file.
The directory of the file needs to be a package, so there needs to be
a ``__init__.py``.
Since the fixture is stored and maintained in the third party project,
it is not part of the python path.
The testserver loads the package of the fixture file under the name
``customfixture``, so that importing from gever as well as from this
directory works well.

@jone jone requested a review from 4teamwork/gever Feb 8, 2019

@lukasgraf
Copy link
Member

lukasgraf left a comment

Looks good to me! 👍

Tested locally with a custom fixture extending from the OpengeverContentFixture, works like a charm 🎉

@lukasgraf

This comment has been minimized.

Copy link
Member

lukasgraf commented Feb 8, 2019

CI Governor seems to have choked on your second push somehow...

@jone jone force-pushed the jone-testserver-custom-fixture branch from a89a60d to a136701 Feb 8, 2019

@jone

This comment has been minimized.

Copy link
Member Author

jone commented Feb 8, 2019

I've pushed an amended commit; let's see 😉

@jone jone force-pushed the jone-testserver-custom-fixture branch from a136701 to fe53b5c Feb 8, 2019

@lukasgraf lukasgraf merged commit 310e865 into master Feb 8, 2019

7 checks passed

CI Governor: test-docs-intern.cfg Task #363446 succeeded
Details
CI Governor: test-docs-public-fr.cfg Task #363447 succeeded
Details
CI Governor: test-docs-public.cfg Task #363448 succeeded
Details
CI Governor: test-i18n-de.cfg Task #363449 succeeded
Details
CI Governor: test-plone-4.3.x.cfg Task #363450 succeeded
Details
CI Governor: test-qa.cfg Task #363451 succeeded
Details
CI Governor: test-xml-convention.cfg Task #363452 succeeded
Details

@lukasgraf lukasgraf deleted the jone-testserver-custom-fixture branch Feb 8, 2019

@deiferni deiferni added this to the Release 2019.1 milestone Feb 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment