py3: replace print() with assert in

Authored by indygreg.


py3: replace print() with assert in

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:


indygregFeb 1 2019, 3:09 PM
Differential Revision
D5795: py3: replace print() with assert in
rHG587a3c976892: py3: pass str into grp.getgrnam