Skip to content

Commit 902b828

Browse files
committed
Make harmless py2 related test
1 parent 79a2786 commit 902b828

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

apsw/tests/__main__.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5061,13 +5061,12 @@ def tracer(cur, sql, bindings):
50615061
self.assertTrue("rollback" in traces)
50625062

50635063
def testIssue142(self):
5064-
"Issue 142: bytes from system during dump"
5065-
orig_strftime = time.strftime
5066-
orig_getuser = getpass.getuser
5064+
# not really relevant any more. python 2 getpass and strftime could
5065+
# return bytes not str. they are used in a fstring now so it doesn't
5066+
# matter, and python 3 only does str. in strict checking mode there
5067+
# would be a warning about str of bytes.
50675068
fh = []
50685069
try:
5069-
time.strftime = lambda arg: b"gjkTIMEJUNKhgjhg\xfe\xdf"
5070-
getpass.getuser = lambda: b"\x81\x82\x83gjkhgUSERJUNKjhg\xfe\xdf"
50715070
fh = [open(TESTFILEPREFIX + "test-shell-" + t, "w+", encoding="utf8") for t in ("in", "out", "err")]
50725071
kwargs = {"stdin": fh[0], "stdout": fh[1], "stderr": fh[2]}
50735072

@@ -5083,14 +5082,9 @@ def testIssue142(self):
50835082
for row in rows:
50845083
self.assertTrue(row[0] in out)
50855084

5086-
self.assertTrue("TIMEJUNK" in out)
5087-
self.assertTrue("USERJUNK" in out)
5088-
50895085
finally:
50905086
for f in fh:
50915087
f.close()
5092-
time.strftime = orig_strftime
5093-
getpass.getuser = orig_getuser
50945088

50955089
def testIssue186(self):
50965090
"Issue 186: desription cache between statements"

0 commit comments

Comments
 (0)