Page MenuHomeSoftware Heritage

loader.mercurial.tests: Bootstrap tests
ClosedPublic

Authored by ardumont on Oct 3 2018, 2:49 PM.

Details

Summary

This injects in 2 different tests, 2 different repositories (one with
2 branches and no tag, another with 1 branch and 1 tag). We then check
the snapshot is targetting accordingly those branches/releases.

The hashes computed are explained in the test_loader.org.

This does not cover all the mercurial use cases.

make coverage (outside of venv though, reports nothing in the venv)
reports 76% of coverage, that's a start.

Related T954

Test Plan

make test

Diff Detail

Repository
rDLDHG Mercurial loader
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

ardumont added inline comments.
swh/loader/mercurial/tests/test_loader.py
21

This needs to get factored out but i consider this out of this scope.

146

This needs to get factored out but i consider this out of this scope for now.
I intend to refactor those after this is merged (as that touches quite some loaders, all but loader-git).

  • loader.tests: Refactor using loader-core mixins

Depends D467

(outside of venv though, reports nothing in the venv)

Ok, that's because we need to pip install coverage in the venv ;)

loader.tests: Refactor using loader-core mixins

I have amended the diff to integrate the loader-core refactoring and its impact here.
I did that to reduce the size of the initial diff.

Tell me if it's not ok, i'll split those in 2 diffs stacked on each other.

Unless I'm mistaken, the tar file the-sandbox.tgz is infact not compressed.

Also, there is no need for the untarred directories to be on tip instead of null revision (makes the tar file a bit smaller).

swh/loader/mercurial/tests/test_loader.py
445

I like to have a

if __name__ == '__main__':
    from unittest import main
    main()

at the end of my python test files, but hey!

please add a __init__.py file in the tests/ directory

This revision now requires changes to proceed.Oct 8 2018, 10:03 AM

Fix multiple issues:

  • Add missing __init__.py
  • Sample mercurial repository the-sandbox.tgz is now compressed
  • Sample mercurial repositories are now checkouted at revision 0 (in archive)
  • Rebased to where the archive were introduced (so no duplicated copies in git repository)
ardumont retitled this revision from Bootstrap mercurial loader tests to loader.mercurial.tests: Bootstrap tests.Oct 8 2018, 2:00 PM
  • mercurial.tests: Do not leak core loader fixture's state
  • Bootstrap mercurial loader test
  • loader.mercurial: Add a second test on origin with tag
  • loader.tests: Refactor using loader-core mixins
  • mercurial.tests: Do not leak core loader fixture's state

+ Rebase

This revision was not accepted when it landed; it landed in state Needs Review.Oct 9 2018, 5:07 PM
This revision was automatically updated to reflect the committed changes.