Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Fix Python unittests in ./test and ./tools #30340

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ jstest: build-addons build-js-native-api-tests build-node-api-tests ## Runs addo

.PHONY: tooltest
tooltest:
@$(PYTHON) test/tools/test-js2c.py
@$(PYTHON) -m unittest discover -s ./test/tools

.PHONY: coverage-run-js
coverage-run-js:
Expand Down
File renamed without changes.
8 changes: 6 additions & 2 deletions tools/gyp/pylib/gyp/MSVSSettings_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@

"""Unit tests for the MSVSSettings.py file."""

import StringIO
import unittest
import gyp.MSVSSettings as MSVSSettings

try:
from StringIO import StringIO # Python 2
except ImportError:
from io import StringIO # Python 3


class TestSequenceFunctions(unittest.TestCase):

def setUp(self):
self.stderr = StringIO.StringIO()
self.stderr = StringIO()

def _ExpectedWarnings(self, expected):
"""Compares recorded lines to expected warnings."""
Expand Down
8 changes: 6 additions & 2 deletions tools/gyp/pylib/gyp/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import collections
import errno
import filecmp
import os.path
import re
import tempfile
import sys

try:
from collections.abc import MutableSet
except ImportError:
from collections import MutableSet


# A minimal memoizing decorator. It'll blow up if the args aren't immutable,
# among other "problems".
Expand Down Expand Up @@ -493,7 +497,7 @@ def uniquer(seq, idfun=None):


# Based on http://code.activestate.com/recipes/576694/.
class OrderedSet(collections.MutableSet):
class OrderedSet(MutableSet):
def __init__(self, iterable=None):
self.end = end = []
end += [None, end, end] # sentinel node for doubly linked list
Expand Down
8 changes: 6 additions & 2 deletions tools/gyp/pylib/gyp/easy_xml_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@

import gyp.easy_xml as easy_xml
import unittest
import StringIO

try:
from StringIO import StringIO # Python 2
except ImportError:
from io import StringIO # Python 3


class TestSequenceFunctions(unittest.TestCase):

def setUp(self):
self.stderr = StringIO.StringIO()
self.stderr = StringIO()

def test_EasyXml_simple(self):
self.assertEqual(
Expand Down
8 changes: 6 additions & 2 deletions tools/gyp/pylib/gyp/generator/msvs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@

import gyp.generator.msvs as msvs
import unittest
import StringIO

try:
from StringIO import StringIO # Python 2
except ImportError:
from io import StringIO # Python 3


class TestSequenceFunctions(unittest.TestCase):

def setUp(self):
self.stderr = StringIO.StringIO()
self.stderr = StringIO()

def test_GetLibraries(self):
self.assertEqual(
Expand Down
7 changes: 3 additions & 4 deletions tools/gyp/pylib/gyp/generator/ninja_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@

""" Unit tests for the ninja.py file. """

import gyp.generator.ninja as ninja
import unittest
import StringIO
import sys
import TestCommon
import unittest

import gyp.generator.ninja as ninja


class TestPrefixesAndSuffixes(unittest.TestCase):
Expand Down