Page MenuHomeSoftware Heritage

Extract kafka-related pytest fixtures in a pytest plugin module
ClosedPublic

Authored by douardda on Apr 22 2020, 3:38 PM.

Details

Diff Detail

Repository
rDJNL Journal infrastructure
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D3043 (id=10822)

Rebasing onto 9afb659fbc...

Current branch diff-target is up to date.
Changes applied before test
commit 532793e680ba2ee8ce141bccf56c8e6cee53e707
Author: David Douard <david.douard@sdfa3.org>
Date:   Wed Apr 22 15:05:34 2020 +0200

    Extract kafka-related pytest fixtures in a pytest plugin module
    
    so it can be used from other packages.

See https://jenkins.softwareheritage.org/job/DJNL/job/tests-on-diff/50/ for more details.

It seems we duplicate the objects data (CONTENT, etc...) both in the pytest_plugin and in the journal_data module.
is that expected?

For the sake of my questions ;)

swh/journal/pytest_plugin.py
156

I think those objects data should go away.
We should only define the fixtures here, shouldn't we?

swh/journal/tests/conftest.py
1

header update ;)

28

Isn't this already defined the model?

This revision now requires changes to proceed.Apr 22 2020, 3:50 PM
swh/journal/pytest_plugin.py
191

And thus hard-coding the object types we want to use here instead.

194

I think in the end, we want to inline this in the test_config below.
And maybe rename that journal_config?

swh/journal/pytest_plugin.py
156

I meant the hard-coded CONTENTS, etc...
They are still already defined in the swh.journal.tests.journal_data module.

Here, they are not used as per the coverage report.
And i think we don't really want to hard-code the use of the data in the pytest plugin.

It seems we duplicate the objects data (CONTENT, etc...) both in the pytest_plugin and in the journal_data module.
is that expected?

Yeah seen that, I messed up a bit my refactorings. Will update soon.

Also, @ardumont I agree with your other comments, but these will come later, if you may :-)

Also, @ardumont I agree with your other comments, but these will come later, if you may :-)

sure thing.

Build is green

Patch application report for D3043 (id=10823)

Rebasing onto 9afb659fbc...

Current branch diff-target is up to date.
Changes applied before test
commit 1f6de9604065af9d0cef22684b0880f65ca9ab54
Author: David Douard <david.douard@sdfa3.org>
Date:   Wed Apr 22 15:05:34 2020 +0200

    Extract kafka-related pytest fixtures in a pytest plugin module
    
    so it can be used from other packages.

See https://jenkins.softwareheritage.org/job/DJNL/job/tests-on-diff/51/ for more details.

This revision is now accepted and ready to land.Apr 22 2020, 4:22 PM

Build is green

Patch application report for D3043 (id=10824)

Rebasing onto 9afb659fbc...

Current branch diff-target is up to date.
Changes applied before test
commit 42f4a89abc72e7dd3dc29ec2cd2f1498a6b444f5
Author: David Douard <david.douard@sdfa3.org>
Date:   Wed Apr 22 15:05:34 2020 +0200

    Extract kafka-related pytest fixtures in a pytest plugin module
    
    so it can be used from other packages.
    
    - put all fixtures as well as the 2 consume_messages() and
      assert_all_objects_consumed() utility functions in
      swh.journal.pytest_plugin,
    - move all hardcoded test data in a dedicated swh.journal.tests.journal_data
      module,
    - declare this new pytest_plugin via the pytest11 entry point.

See https://jenkins.softwareheritage.org/job/DJNL/job/tests-on-diff/52/ for more details.