py3: make .py tests continue to run on python 2

Summary:
Use sed to convert testutil.ddot requires to hghave.

ignore-conflict-markers

for test-simplemerge.py

Reviewed By: simpkins

Differential Revision: D19658355

fbshipit-source-id: afae73eb1e43ead79514dfaf9f911f51ac25972e
This commit is contained in:
Simon Farnsworth 2020-01-31 00:16:29 -08:00 committed by Facebook Github Bot
parent 4e10dbb9f6
commit 5232dcf9d1
58 changed files with 118 additions and 119 deletions

View File

@ -10,10 +10,10 @@ import time
from edenscm.mercurial import ancestor, debugcommands, hg, pycompat, ui as uimod, util from edenscm.mercurial import ancestor, debugcommands, hg, pycompat, ui as uimod, util
from edenscm.mercurial.node import nullrev from edenscm.mercurial.node import nullrev
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
if sys.version_info[0] >= 3: if sys.version_info[0] >= 3:
long = int long = int

View File

@ -4,10 +4,10 @@ import unittest
from edenscm.mercurial import mdiff from edenscm.mercurial import mdiff
from edenscm.mercurial.context import _annotatepair, annotateline from edenscm.mercurial.context import _annotatepair, annotateline
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
try: try:
xrange(0) xrange(0)

View File

@ -9,11 +9,11 @@ from __future__ import absolute_import
import os import os
import sys import sys
from hghave import require
from testutil import argspans from testutil import argspans
from testutil.dott import feature
feature.require(["py2"]) require(["py2"])
try: try:

View File

@ -7,10 +7,10 @@ import tempfile
import unittest import unittest
from edenscm.mercurial import util from edenscm.mercurial import util
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
atomictempfile = util.atomictempfile atomictempfile = util.atomictempfile

View File

@ -8,10 +8,10 @@
from __future__ import absolute_import, print_function from __future__ import absolute_import, print_function
from edenscm.mercurial import error, peer, util, wireproto from edenscm.mercurial import error, peer, util, wireproto
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
# equivalent of repo.repository # equivalent of repo.repository

View File

@ -5,10 +5,10 @@ import struct
import unittest import unittest
from edenscm.mercurial import mdiff from edenscm.mercurial import mdiff
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
class diffreplace(collections.namedtuple("diffreplace", "start end from_ to")): class diffreplace(collections.namedtuple("diffreplace", "start end from_ to")):

View File

@ -9,10 +9,10 @@ import unittest
import silenttestrunner import silenttestrunner
from bindings import bookmarkstore from bindings import bookmarkstore
from edenscm.mercurial import node from edenscm.mercurial import node
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
class bookmarkstoretests(unittest.TestCase): class bookmarkstoretests(unittest.TestCase):

View File

@ -3,10 +3,10 @@
from __future__ import absolute_import, print_function from __future__ import absolute_import, print_function
from edenscm.mercurial import bundlerepo, httppeer, localrepo, sshpeer, ui as uimod from edenscm.mercurial import bundlerepo, httppeer, localrepo, sshpeer, ui as uimod
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
def checkobject(o): def checkobject(o):

View File

@ -6,10 +6,10 @@
import os import os
import re import re
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
def checkpath(path, dllnames): def checkpath(path, dllnames):

View File

@ -4,10 +4,10 @@ import os
from edenscm.mercurial import context, encoding, hg, scmutil, ui as uimod from edenscm.mercurial import context, encoding, hg, scmutil, ui as uimod
from edenscm.mercurial.node import hex from edenscm.mercurial.node import hex
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
u = uimod.ui.load() u = uimod.ui.load()

View File

@ -9,9 +9,9 @@ demandimport.enable()
import os import os
import subprocess import subprocess
import sys import sys
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
# Only run if demandimport is allowed # Only run if demandimport is allowed
if subprocess.call(["python", "%s/hghave" % os.environ["TESTDIR"], "demandimport"]): if subprocess.call(["python", "%s/hghave" % os.environ["TESTDIR"], "demandimport"]):

View File

@ -3,10 +3,10 @@ from __future__ import absolute_import, print_function
import os import os
from edenscm.mercurial import dispatch from edenscm.mercurial import dispatch
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
def testdispatch(cmd): def testdispatch(cmd):

View File

@ -7,10 +7,10 @@ import os
import re import re
import sys import sys
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
ispy3 = sys.version_info[0] >= 3 ispy3 = sys.version_info[0] >= 3

View File

@ -3,10 +3,10 @@ from __future__ import absolute_import, print_function
import os import os
from edenscm.mercurial import commands, extensions, ui as uimod from edenscm.mercurial import commands, extensions, ui as uimod
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
ignore = { ignore = {

View File

@ -3,10 +3,10 @@ from __future__ import absolute_import
import unittest import unittest
from edenscm.mercurial import encoding from edenscm.mercurial import encoding
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
class IsasciistrTest(unittest.TestCase): class IsasciistrTest(unittest.TestCase):

View File

@ -1,10 +1,10 @@
from __future__ import absolute_import, print_function from __future__ import absolute_import, print_function
from edenscm.mercurial import extensions from edenscm.mercurial import extensions
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
def genwrapper(x): def genwrapper(x):

View File

@ -2,10 +2,10 @@ import os
import unittest import unittest
from edenscm.hgext.convert.repo import gitutil, repo from edenscm.hgext.convert.repo import gitutil, repo
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
def draft(test_func): def draft(test_func):

View File

@ -3,10 +3,10 @@ from __future__ import absolute_import
import itertools import itertools
from edenscm.hgext import absorb from edenscm.hgext import absorb
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
class simplefctx(object): class simplefctx(object):

View File

@ -10,10 +10,10 @@ import unittest
import silenttestrunner import silenttestrunner
from edenscm.hgext import extutil from edenscm.hgext import extutil
from edenscm.mercurial import error, vfs, worker from edenscm.mercurial import error, vfs, worker
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
locktimeout = 25 locktimeout = 25

View File

@ -4,10 +4,10 @@ import os
import tempfile import tempfile
from edenscm.hgext.fastannotate import error, revmap from edenscm.hgext.fastannotate import error, revmap
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
try: try:

View File

@ -3,10 +3,10 @@ from __future__ import absolute_import
import unittest import unittest
import silenttestrunner import silenttestrunner
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
class BisectTests(unittest.TestCase): class BisectTests(unittest.TestCase):

View File

@ -5,10 +5,10 @@ import sys
from edenscm.hgext import patchrmdir from edenscm.hgext import patchrmdir
from edenscm.mercurial import util from edenscm.mercurial import util
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
if not sys.platform.startswith("linux"): if not sys.platform.startswith("linux"):

View File

@ -18,10 +18,10 @@ from edenscm.hgext.remotefilelog import constants
from edenscm.hgext.remotefilelog.datapack import datapackstore from edenscm.hgext.remotefilelog.datapack import datapackstore
from edenscm.mercurial import error from edenscm.mercurial import error
from edenscm.mercurial.node import nullid from edenscm.mercurial.node import nullid
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
SMALLFANOUTCUTOFF = 2 ** 16 / 8 SMALLFANOUTCUTOFF = 2 ** 16 / 8

View File

@ -15,10 +15,10 @@ from bindings import revisionstore
from edenscm.hgext.remotefilelog.metadatastore import unionmetadatastore from edenscm.hgext.remotefilelog.metadatastore import unionmetadatastore
from edenscm.mercurial import error, ui as uimod, util from edenscm.mercurial import error, ui as uimod, util
from edenscm.mercurial.node import nullid from edenscm.mercurial.node import nullid
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
SMALLFANOUTCUTOFF = 2 ** 16 / 8 SMALLFANOUTCUTOFF = 2 ** 16 / 8

View File

@ -7,10 +7,10 @@ import sys
# Make sure we use sshaskpass.py in this repo, unaffected by PYTHONPATH # Make sure we use sshaskpass.py in this repo, unaffected by PYTHONPATH
from edenscm.hgext import sshaskpass from edenscm.hgext import sshaskpass
from edenscm.mercurial import error from edenscm.mercurial import error
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
if not sys.platform.startswith("linux"): if not sys.platform.startswith("linux"):

View File

@ -12,10 +12,10 @@ from edenscm.mercurial import (
util, util,
vfs as vfsmod, vfs as vfsmod,
) )
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
try: try:

View File

@ -6,10 +6,10 @@ from __future__ import absolute_import, print_function
from edenscm.mercurial import hg, ui as uimod from edenscm.mercurial import hg, ui as uimod
from edenscm.mercurial.node import hex, nullid from edenscm.mercurial.node import hex, nullid
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
myui = uimod.ui.load() myui = uimod.ui.load()

View File

@ -1,10 +1,10 @@
from __future__ import absolute_import, print_function from __future__ import absolute_import, print_function
from edenscm.mercurial import hg from edenscm.mercurial import hg
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
def testparse(url, branch=[]): def testparse(url, branch=[]):

View File

@ -5,10 +5,10 @@ import sys
import tempfile import tempfile
from edenscm.mercurial import commands, hg, ui from edenscm.mercurial import commands, hg, ui
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
try: try:

View File

@ -1,10 +1,10 @@
from __future__ import absolute_import, print_function from __future__ import absolute_import, print_function
from edenscm.mercurial import store from edenscm.mercurial import store
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
def show(s): def show(s):

View File

@ -1,10 +1,10 @@
from __future__ import absolute_import, print_function from __future__ import absolute_import, print_function
from edenscm.hgext.lfs import pointer from edenscm.hgext.lfs import pointer
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
def tryparse(text): def tryparse(text):

View File

@ -3,10 +3,10 @@ from __future__ import absolute_import
import unittest import unittest
from edenscm.mercurial import error, mdiff from edenscm.mercurial import error, mdiff
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
# for readability, line numbers are 0-origin # for readability, line numbers are 0-origin

View File

@ -3,10 +3,10 @@ from __future__ import absolute_import, print_function
import tempfile import tempfile
from edenscm.hgext import linkrevcache from edenscm.hgext import linkrevcache
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
try: try:

View File

@ -17,10 +17,10 @@ from edenscm.mercurial import (
util, util,
vfs as vfsmod, vfs as vfsmod,
) )
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
testlockname = "testlock" testlockname = "testlock"

View File

@ -1,10 +1,10 @@
from __future__ import absolute_import, print_function from __future__ import absolute_import, print_function
from edenscm.mercurial import util from edenscm.mercurial import util
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
def printifpresent(d, xs, name="d"): def printifpresent(d, xs, name="d"):

View File

@ -6,10 +6,10 @@ import unittest
import silenttestrunner import silenttestrunner
from edenscm.mercurial import manifest as manifestmod, match as matchmod from edenscm.mercurial import manifest as manifestmod, match as matchmod
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
EMTPY_MANIFEST = b"" EMTPY_MANIFEST = b""

View File

@ -4,10 +4,10 @@ import unittest
import silenttestrunner import silenttestrunner
from edenscm.mercurial import match as matchmod from edenscm.mercurial import match as matchmod
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
class NeverMatcherTests(unittest.TestCase): class NeverMatcherTests(unittest.TestCase):

View File

@ -3,10 +3,10 @@ from __future__ import absolute_import, print_function
import pprint import pprint
from edenscm.mercurial import minirst from edenscm.mercurial import minirst
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
def debugformat(text, form, **kwargs): def debugformat(text, form, **kwargs):

View File

@ -17,10 +17,10 @@ import sys
import time import time
from edenscm.mercurial import pycompat, store from edenscm.mercurial import pycompat, store
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
try: try:

View File

@ -10,10 +10,10 @@ import os
import subprocess import subprocess
from edenscm.mercurial import hg, localrepo, ui as uimod, util from edenscm.mercurial import hg, localrepo, ui as uimod, util
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
# create some special property cache that trace they call # create some special property cache that trace they call

View File

@ -3,10 +3,10 @@ from __future__ import absolute_import, print_function
import os import os
from edenscm.mercurial import hg, merge, ui as uimod from edenscm.mercurial import hg, merge, ui as uimod
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
u = uimod.ui.load() u = uimod.ui.load()

View File

@ -5,10 +5,10 @@ from __future__ import absolute_import, print_function
import sys import sys
from edenscm.mercurial import encoding, node, revlog, transaction, vfs from edenscm.mercurial import encoding, node, revlog, transaction, vfs
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
# TESTTMP is optional. This makes it convenient to run without run-tests.py # TESTTMP is optional. This makes it convenient to run without run-tests.py

View File

@ -9,10 +9,10 @@ import doctest
import os import os
import re import re
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
# this is hack to make sure no escape characters are inserted into the output # this is hack to make sure no escape characters are inserted into the output

View File

@ -49,11 +49,6 @@
from __future__ import absolute_import from __future__ import absolute_import
from testutil.dott import feature
feature.require(["py2"])
import os import os
import thread import thread
import threading import threading
@ -63,6 +58,10 @@ from thread import get_ident, start_new_thread
import silenttestrunner import silenttestrunner
from bindings import threading as rustthreading from bindings import threading as rustthreading
from hghave import require
require(["py2"])
# From test_support.py # From test_support.py

View File

@ -5,10 +5,10 @@ import unittest
import silenttestrunner import silenttestrunner
from edenscm.mercurial import error, scmutil from edenscm.mercurial import error, scmutil
from edenscm.mercurial.pycompat import encodeutf8 from edenscm.mercurial.pycompat import encodeutf8
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
class mockfile(object): class mockfile(object):

View File

@ -18,10 +18,10 @@ from __future__ import absolute_import
import unittest import unittest
from edenscm.mercurial import error, simplemerge, util from edenscm.mercurial import error, simplemerge, util
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
TestCase = unittest.TestCase TestCase = unittest.TestCase

View File

@ -5,10 +5,10 @@ import unittest
import silenttestrunner import silenttestrunner
from edenscm.mercurial import sshserver, wireproto from edenscm.mercurial import sshserver, wireproto
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
class SSHServerGetArgsTests(unittest.TestCase): class SSHServerGetArgsTests(unittest.TestCase):

View File

@ -6,9 +6,9 @@
import os import os
import sys import sys
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
if os.name == "nt": if os.name == "nt":
sys.exit(80) sys.exit(80)

View File

@ -5,10 +5,10 @@ import sys
import time import time
from edenscm.mercurial import commands, fscap, hg, ui as uimod, util from edenscm.mercurial import commands, fscap, hg, ui as uimod, util
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
TESTDIR = os.environ["TESTDIR"] TESTDIR = os.environ["TESTDIR"]

View File

@ -9,10 +9,10 @@ import unittest
import silenttestrunner import silenttestrunner
from bindings import treestate from bindings import treestate
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
testtmp = os.getenv("TESTTMP") or tempfile.mkdtemp("test-treestate") testtmp = os.getenv("TESTTMP") or tempfile.mkdtemp("test-treestate")

View File

@ -3,10 +3,10 @@ from __future__ import absolute_import, print_function
import os import os
from edenscm.mercurial import dispatch, ui as uimod from edenscm.mercurial import dispatch, ui as uimod
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
# ensure errors aren't buffered # ensure errors aren't buffered

View File

@ -1,10 +1,10 @@
from __future__ import absolute_import, print_function from __future__ import absolute_import, print_function
from edenscm.mercurial import dispatch, error, ui as uimod from edenscm.mercurial import dispatch, error, ui as uimod
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
testui = uimod.ui.load() testui = uimod.ui.load()

View File

@ -3,10 +3,10 @@ from __future__ import absolute_import, print_function
import os import os
from edenscm.mercurial import ui as uimod from edenscm.mercurial import ui as uimod
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
hgrc = os.environ["HGRCPATH"] hgrc = os.environ["HGRCPATH"]

View File

@ -5,10 +5,10 @@ import doctest
import os import os
from edenscm.mercurial import sslutil from edenscm.mercurial import sslutil
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
def check(a, b): def check(a, b):

View File

@ -11,9 +11,9 @@ unexpected errors and to compare different versions of it."""
import os import os
import subprocess import subprocess
import sys import sys
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
# Only run if slow tests are allowed # Only run if slow tests are allowed
if subprocess.call(["python", "%s/hghave" % os.environ["TESTDIR"], "slow"]): if subprocess.call(["python", "%s/hghave" % os.environ["TESTDIR"], "slow"]):

View File

@ -3,10 +3,10 @@ from __future__ import absolute_import, print_function
import os import os
from edenscm.mercurial import hg, scmutil, ui as uimod, util from edenscm.mercurial import hg, scmutil, ui as uimod, util
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
chdir = os.chdir chdir = os.chdir

View File

@ -1,10 +1,10 @@
from __future__ import absolute_import, print_function from __future__ import absolute_import, print_function
from edenscm.mercurial import ui, util, wireproto from edenscm.mercurial import ui, util, wireproto
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
stringio = util.stringio stringio = util.stringio

View File

@ -5,10 +5,10 @@ import unittest
import silenttestrunner import silenttestrunner
from bindings import zstd from bindings import zstd
from testutil.dott import feature from hghave import require
feature.require(["py2"]) require(["py2"])
class testzstd(unittest.TestCase): class testzstd(unittest.TestCase):