This is an archive of the discontinued Mercurial Phabricator instance.

test-cstore: run native Python tests directly
ClosedPublic

Authored by quark on Nov 15 2017, 4:38 PM.
Tags
None
Subscribers

Details

Reviewers
durham
Group Reviewers
Restricted Project
Commits
rFBHGXcfe92441f1c4: test-cstore: run native Python tests directly
Summary

Previously the test sets up LD_LIBRARY_PATH and PYTHONPATH, then runs
Python tests.

Within Python code, setting sys.path would achieve the same effect of
setting PYTHONPATH. For LD_LIBRARY_PATH, it's necessary for C libraries.
But the only C library that cstore depends on is lz4, which is supposed to
use the system version. There is no C library provided by this repo -
features like sha1 are compiled in cstore.so.

Therefore it's unnecessary to have a separate .t file wrapping .py
tests. Let's just use .py tests directly.

Test Plan

./script/unit.py

Make a temporary change to cdatapack.c so it fails unconditionally in
open_datapack. Build the repo in different ways: make local and
python2 setup.py build_clib build_ext. Then run the test by using
$HG_CREW/tests/run-tests.py -l test-remotefilelog-datapack.py and make
sure it fails with the expected exception.

Diff Detail

Repository
rFBHGX Facebook Mercurial Extensions
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

quark created this revision.Nov 15 2017, 4:38 PM
Herald added a reviewer: Restricted Project. · View Herald TranscriptNov 15 2017, 4:38 PM
durham accepted this revision.Nov 16 2017, 1:43 PM
durham added a subscriber: durham.

Could you test that the tests are still executing the built c datapack stuff and not the system one? Just add an exception to some C code and run the tests and make sure they fail.

This revision is now accepted and ready to land.Nov 16 2017, 1:43 PM

In particular, make sure it works outside of hg-dev

quark edited the test plan for this revision. (Show Details)Nov 16 2017, 1:55 PM
quark updated this revision to Diff 3571.
This revision was automatically updated to reflect the committed changes.
tests/test-cstore-uniondatapackstore.py