This is an archive of the discontinued Mercurial Phabricator instance.

tests: make #testcase available as env var in test
ClosedPublic

Authored by martinvonz on Jan 5 2018, 3:03 PM.

Details

Summary

It can be useful for e.g. helper functions to behave differently
depending on which test case is being executed. This patch helps with
that by making the #testcase case available as a TESTCASE environment
variable.

Diff Detail

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

Event Timeline

martinvonz created this revision.Jan 5 2018, 3:03 PM
quark added inline comments.Jan 5 2018, 3:56 PM
tests/run-tests.py
1338

Maybe util.shellquote the name.

quark accepted this revision.Jan 5 2018, 3:57 PM
martinvonz marked an inline comment as done.Jan 5 2018, 4:05 PM
martinvonz updated this revision to Diff 4716.
martinvonz marked an inline comment as not done.Jan 5 2018, 4:06 PM
martinvonz added inline comments.
tests/run-tests.py
1338

Done (but it seems to be just shellquote in the test runner).

yuja requested changes to this revision.Jan 5 2018, 9:38 PM
yuja added a subscriber: yuja.
yuja added inline comments.
tests/run-tests.py
1338

Needs export TESTCASE to export shell variables to environment.

This revision now requires changes to proceed.Jan 5 2018, 9:38 PM
martinvonz marked an inline comment as not done.Jan 6 2018, 1:20 AM
martinvonz added inline comments.
tests/run-tests.py
1338

Needs export TESTCASE to export shell variables to environment.

Sure, will do. I wasn't sure if I should or shouldn't. Are you thinking that it may be useful if the function in my test case is instead a stand-alone script/binary?

martinvonz updated this revision to Diff 4730.Jan 6 2018, 1:32 AM
yuja accepted this revision.Jan 6 2018, 2:27 AM

Are you thinking that it may be useful if the function in my test case is instead a stand-alone script/binary?

No idea if it'll be useful, but there seemed no reason to narrow the scope
of $TESTCASE variable.

Queued, thanks.

This revision is now accepted and ready to land.Jan 6 2018, 2:27 AM
This revision was automatically updated to reflect the committed changes.