Mercurial > hg
view CONTRIBUTING @ 41505:dffd6a301570
py3: replace print() with assert in test-demandimport.py
Behavior of demand imports behaves differently between Python 2 and 3.
.out files do not support conditional output the way that .t files do.
In order to make this test work on Python 3, we'll need to make the
test itself conditional.
The first step of this is to port the test to not use a .out file
to compare output.
Unfortunately, we can't easily use the unittest framework for
defining this test because putting import statements in functions
changes the behavior of the demand importer (at least on Python 2).
So, we effectively replace a bunch of print() with assert statements.
This makes the test a bit annoying to debug, as the test will
stop at first assertion failure. But we don't exactly have
a good alternative.
Differential Revision: https://phab.mercurial-scm.org/D5795
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 01 Feb 2019 12:09:05 -0800 |
parents | a492610a2fc1 |
children |
line wrap: on
line source
Our full contribution guidelines are in our wiki, please see: https://www.mercurial-scm.org/wiki/ContributingChanges If you just want a checklist to follow, you can go straight to https://www.mercurial-scm.org/wiki/ContributingChanges#Submission_checklist If you can't run the entire testsuite for some reason (it can be difficult on Windows), please at least run `contrib/check-code.py` on any files you've modified and run `python contrib/check-commit` on any commits you've made (for example, `python contrib/check-commit 273ce12ad8f1` will report some style violations on a very old commit).