Skip to content

Commit

Permalink
build: import StringIO on Python 2 and Python 3
Browse files Browse the repository at this point in the history
This change supports access to StringIO on both Python 2 and Python 3

PR-URL: #1836
Reviewed-By: Rod Vagg <[email protected]>
Reviewed-By: João Reis <[email protected]>
  • Loading branch information
cclauss authored and joaocgreis committed Jul 23, 2019
1 parent 4ef83ed commit 5459eca
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
8 changes: 6 additions & 2 deletions 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
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO

import unittest
import gyp.MSVSSettings as MSVSSettings


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
7 changes: 5 additions & 2 deletions gyp/pylib/gyp/easy_xml_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@

import gyp.easy_xml as easy_xml
import unittest
import StringIO
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO


class TestSequenceFunctions(unittest.TestCase):

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

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

import gyp.generator.msvs as msvs
import unittest
import StringIO
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO


class TestSequenceFunctions(unittest.TestCase):

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

def test_GetLibraries(self):
self.assertEqual(
Expand Down
5 changes: 4 additions & 1 deletion gyp/pylib/gyp/generator/ninja.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
import gyp.msvs_emulation
import gyp.MSVSUtil as MSVSUtil
import gyp.xcode_emulation
from cStringIO import StringIO
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO

from gyp.common import GetEnvironFallback
import gyp.ninja_syntax as ninja_syntax
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 @@ -8,7 +8,6 @@

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

Expand Down

0 comments on commit 5459eca

Please sign in to comment.