Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
41504:587a3c976892 | 41505:dffd6a301570 |
---|