[PATCH 2 of 2] tests: make test-atomictempfile use absolute_import

Pulkit Goyal 7895pulkit at gmail.com
Sat Apr 16 04:14:06 EDT 2016


# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1460791173 -19800
#      Sat Apr 16 12:49:33 2016 +0530
# Node ID b9ab069066106bcaf834d33ce2434a1d45e5cac5
# Parent  6276e8c283b5071663dcc04087c1edaccddb9ca8
tests: make test-atomictempfile use absolute_import

Direct importing silenttestrunner was causing an error that stlib import is followed by local import and importing it directly after unittest will make it lexicographically unsorted.

diff -r 6276e8c283b5 -r b9ab06906610 tests/test-atomictempfile.py
--- a/tests/test-atomictempfile.py	Sat Apr 16 12:41:58 2016 +0530
+++ b/tests/test-atomictempfile.py	Sat Apr 16 12:49:33 2016 +0530
@@ -1,9 +1,16 @@
+from __future__ import absolute_import
+
+import glob
 import os
-import glob
 import unittest
-import silenttestrunner
 
-from mercurial.util import atomictempfile
+from . import silenttestrunner
+
+from mercurial import (
+    util,
+)
+
+atomictempfile = util.atomictempfile
 
 class testatomictempfile(unittest.TestCase):
     def test1_simple(self):
diff -r 6276e8c283b5 -r b9ab06906610 tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t	Sat Apr 16 12:41:58 2016 +0530
+++ b/tests/test-check-py3-compat.t	Sat Apr 16 12:49:33 2016 +0530
@@ -52,7 +52,6 @@
   tests/sitecustomize.py not using absolute_import
   tests/svn-safe-append.py not using absolute_import
   tests/svnxml.py not using absolute_import
-  tests/test-atomictempfile.py not using absolute_import
   tests/test-demandimport.py not using absolute_import
 
 #if py3exe


More information about the Mercurial-devel mailing list