]> granicus.if.org Git - python/commitdiff
Issue #27829: libregrtest.save_env: flush stderr
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 22 Aug 2016 12:29:54 +0000 (14:29 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 22 Aug 2016 12:29:54 +0000 (14:29 +0200)
Use flush=True to try to get a warning which is missing in buildbots.

Use also f-string to make the code shorter.

Lib/test/libregrtest/save_env.py

index 261c8f4753cf20aab7c47344d49b70345d8a2dc7..96ad3af8df4cf79c4f91cd3d4dfb72b84844bcfe 100644 (file)
@@ -277,11 +277,9 @@ class saved_test_environment:
                 self.changed = True
                 restore(original)
                 if not self.quiet and not self.pgo:
-                    print("Warning -- {} was modified by {}".format(
-                                                 name, self.testname),
-                                                 file=sys.stderr)
+                    print(f"Warning -- {name} was modified by {self.testname}",
+                          file=sys.stderr, flush=True)
                     if self.verbose > 1:
-                        print("  Before: {}\n  After:  {} ".format(
-                                                  original, current),
-                                                  file=sys.stderr)
+                        print(f"  Before: {original}\n  After:  {current} ",
+                              file=sys.stderr, flush=True)
         return False