mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
tests: do not mangle sys.path
Summary: Mangling `sys.path` in `.py` tests could break tests running with `buck` opt build. Because the bundled extensions won't be used, but files in the working copy will. It's okay-ish for pure Python extensions. But native extensions will have problems. Reviewed By: ryanmce Differential Revision: D6974954 fbshipit-source-id: 8a7f3d86e5c2fbf16cfcc971743d99585fe61b99
This commit is contained in:
parent
6ecd47c391
commit
51be4ac4b9
@ -1,11 +1,6 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
import itertools
|
||||
import os
|
||||
import sys
|
||||
|
||||
# make it runnable directly without run-tests.py
|
||||
sys.path[0:0] = [os.path.join(os.path.dirname(__file__), '..')]
|
||||
|
||||
from hgext import absorb
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
import errno
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import unittest
|
||||
|
||||
@ -14,10 +13,7 @@ from mercurial import (
|
||||
worker,
|
||||
)
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.path.insert(0, os.path.join(os.environ["TESTDIR"], "..", "hgext"))
|
||||
|
||||
import extutil
|
||||
from hgext import extutil
|
||||
|
||||
locktimeout = 25
|
||||
locksuccess = 24
|
||||
|
@ -4,9 +4,6 @@ import os
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
# make it runnable using python directly without run-tests.py
|
||||
sys.path[0:0] = [os.path.join(os.path.dirname(__file__), '..')]
|
||||
|
||||
from hgext.fastannotate import error, revmap
|
||||
|
||||
try:
|
||||
|
@ -1,7 +1,6 @@
|
||||
import silenttestrunner
|
||||
import unittest
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
from mercurial import error
|
||||
@ -174,6 +173,5 @@ class HybridManifest(unittest.TestCase):
|
||||
lambda: vfs.lstat("lock"))
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.path.insert(0, os.path.join(os.environ["TESTDIR"], ".."))
|
||||
from hgext import fastmanifest
|
||||
silenttestrunner.main(__name__)
|
||||
|
@ -1,7 +1,5 @@
|
||||
import unittest
|
||||
import os
|
||||
import silenttestrunner
|
||||
import sys
|
||||
|
||||
class BisectTests(unittest.TestCase):
|
||||
def testSimple(self):
|
||||
@ -51,6 +49,5 @@ class BisectTests(unittest.TestCase):
|
||||
self.assertEqual(bisect(0, len(array) - 1, comp, value), result)
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.path.insert(0, os.path.join(os.environ["TESTDIR"], "..", "hgext"))
|
||||
from generic_bisect import bisect
|
||||
from hgext.generic_bisect import bisect
|
||||
silenttestrunner.main(__name__)
|
||||
|
@ -3,9 +3,6 @@ from __future__ import absolute_import, print_function
|
||||
import os
|
||||
import sys
|
||||
|
||||
# make it runnable directly without run-tests.py
|
||||
sys.path[0:0] = [os.path.join(os.path.dirname(__file__), '..')]
|
||||
|
||||
if not sys.platform.startswith('linux'):
|
||||
sys.stderr.write('skipped: linux required\n')
|
||||
sys.exit(80)
|
||||
|
@ -1,11 +1,5 @@
|
||||
from __future__ import absolute_import, print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
# make it runnable using python directly without run-tests.py
|
||||
sys.path[0:0] = [os.path.join(os.path.dirname(__file__), '..')]
|
||||
|
||||
from hgext.lfs import pointer
|
||||
|
||||
def tryparse(text):
|
||||
|
@ -1,12 +1,7 @@
|
||||
from __future__ import absolute_import, print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
# make it runnable using python directly without run-tests.py
|
||||
sys.path[0:0] = [os.path.join(os.path.dirname(__file__), '..')]
|
||||
|
||||
from hgext import linkrevcache
|
||||
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user