Skip to content

Commit

Permalink
test: fix Python unittests
Browse files Browse the repository at this point in the history
PR-URL: #1961
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: João Reis <reis@janeasystems.com>
  • Loading branch information
cclauss authored and rvagg committed Nov 18, 2019
1 parent e12b00a commit b7c8233
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 306 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ matrix:

install:
#- pip install -r requirements.txt
- pip install flake8 # pytest # add another testing frameworks later
- pip install --upgrade flake8 pytest==4.6.6 # pytest 5 no longer supports legacy Python
before_script:
- flake8 --version
# stop the build if there are Python syntax errors or undefined names
Expand All @@ -95,7 +95,7 @@ before_script:
script:
- node -e 'require("npmlog").level="verbose"; require("./lib/find-python")(null,()=>{})'
- npm test
#- pytest --capture=sys # add other tests here
- GYP_MSVS_VERSION=2015 GYP_MSVS_OVERRIDE_PATH="C:\\Dummy" pytest
notifications:
on_success: change
on_failure: change # `always` will be the setting once code changes slow down
2 changes: 1 addition & 1 deletion gyp/gyp_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def UnixifyPath(path):
out = subprocess.Popen(["cygpath", "-u", path],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
stdout, stderr = out.communicate()
stdout, _ = out.communicate()
if PY3:
stdout = stdout.decode("utf-8")
return str(stdout)
Expand Down
2 changes: 2 additions & 0 deletions gyp/pylib/gyp/MSVSSettings_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,7 @@ def testConvertToMSBuildSettings_full_synthetic(self):
'GenerateManifest': 'true',
'IgnoreImportLibrary': 'true',
'LinkIncremental': 'false'}}
self.maxDiff = 9999 # on failure display a long diff
actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(
msvs_settings,
self.stderr)
Expand Down Expand Up @@ -1476,6 +1477,7 @@ def testConvertToMSBuildSettings_actual(self):
'ResourceOutputFileName':
'$(IntDir)$(TargetFileName).embed.manifest.resfdsf'}
}
self.maxDiff = 9999 # on failure display a long diff
actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(
msvs_settings,
self.stderr)
Expand Down
8 changes: 6 additions & 2 deletions gyp/pylib/gyp/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# 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
Expand All @@ -11,6 +10,11 @@
import sys
import subprocess

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

PY3 = bytes != str


Expand Down Expand Up @@ -496,7 +500,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
14 changes: 3 additions & 11 deletions gyp/pylib/gyp/generator/msvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import subprocess
import sys

from collections import OrderedDict

import gyp.common
import gyp.easy_xml as easy_xml
import gyp.generator.ninja as ninja_generator
Expand All @@ -27,16 +29,6 @@

PY3 = bytes != str

# TODO: Remove once bots are on 2.7, http://crbug.com/241769
def _import_OrderedDict():
import collections
try:
return collections.OrderedDict
except AttributeError:
import gyp.ordered_dict
return gyp.ordered_dict.OrderedDict
OrderedDict = _import_OrderedDict()


# Regular expression for validating Visual Studio GUIDs. If the GUID
# contains lowercase hex letters, MSVS will be fine. However,
Expand Down Expand Up @@ -179,7 +171,7 @@ def _FixPath(path):


def _IsWindowsAbsPath(path):
"""
r"""
On Cygwin systems Python needs a little help determining if a path is an absolute Windows path or not, so that
it does not treat those as relative, which results in bad paths like:
Expand Down
1 change: 0 additions & 1 deletion gyp/pylib/gyp/generator/ninja_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import gyp.generator.ninja as ninja
import unittest
import sys
import TestCommon


class TestPrefixesAndSuffixes(unittest.TestCase):
Expand Down
Loading

0 comments on commit b7c8233

Please sign in to comment.