Enable testing on MacOS

Attempt to reproduce local failure of 4 tests which reproduces with
multiple python versions, likely OSX specific.
This commit is contained in:
Sorin Sbarnea
2020-08-20 09:31:52 +01:00
parent 8da98f2122
commit 9856706880
3 changed files with 22 additions and 7 deletions

View File

@@ -8,6 +8,20 @@ python:
- 3.7 - 3.7
- 3.8 - 3.8
- nightly - nightly
jobs:
include:
- python: 2.7
os: osx
env: REMOVE_LOCALES=false
- python: 2.7
os: osx
env: REMOVE_LOCALES=true
- python: 3.8
os: osx
env: REMOVE_LOCALES=false
- python: 3.8
os: osx
env: REMOVE_LOCALES=true
env: env:
- REMOVE_LOCALES=false - REMOVE_LOCALES=false
- REMOVE_LOCALES=true - REMOVE_LOCALES=true

View File

@@ -116,9 +116,9 @@ class KeyOrderingTestCase(RuleTestCase):
def test_locale_case(self): def test_locale_case(self):
self.addCleanup(locale.setlocale, locale.LC_ALL, (None, None)) self.addCleanup(locale.setlocale, locale.LC_ALL, (None, None))
try: try:
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') locale.setlocale(locale.LC_ALL, 'C.UTF-8')
except locale.Error: except locale.Error:
self.skipTest('locale en_US.UTF-8 not available') self.skipTest('locale C.UTF-8 not available')
conf = ('key-ordering: enable') conf = ('key-ordering: enable')
self.check('---\n' self.check('---\n'
't-shirt: 1\n' 't-shirt: 1\n'
@@ -135,9 +135,9 @@ class KeyOrderingTestCase(RuleTestCase):
def test_locale_accents(self): def test_locale_accents(self):
self.addCleanup(locale.setlocale, locale.LC_ALL, (None, None)) self.addCleanup(locale.setlocale, locale.LC_ALL, (None, None))
try: try:
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') locale.setlocale(locale.LC_ALL, 'C.UTF-8')
except locale.Error: except locale.Error:
self.skipTest('locale en_US.UTF-8 not available') self.skipTest('locale C.UTF-8 not available')
conf = ('key-ordering: enable') conf = ('key-ordering: enable')
self.check('---\n' self.check('---\n'
'hair: true\n' 'hair: true\n'

View File

@@ -308,13 +308,14 @@ class CommandLineTestCase(unittest.TestCase):
self.addCleanup(os.environ.update, HOME=os.environ['HOME']) self.addCleanup(os.environ.update, HOME=os.environ['HOME'])
os.environ['HOME'] = home os.environ['HOME'] = home
os.environ.pop('XDG_CONFIG_HOME', None)
with open(config, 'w') as f: with open(config, 'w') as f:
f.write('rules: {trailing-spaces: disable}') f.write('rules: {trailing-spaces: disable}')
with RunContext(self) as ctx: with RunContext(self) as ctx:
cli.run((os.path.join(self.wd, 'a.yaml'), )) cli.run((os.path.join(self.wd, 'a.yaml'), ))
self.assertEqual(ctx.returncode, 0) self.assertEqual(ctx.returncode, 0, msg="%s" % config)
with open(config, 'w') as f: with open(config, 'w') as f:
f.write('rules: {trailing-spaces: enable}') f.write('rules: {trailing-spaces: enable}')
@@ -347,9 +348,9 @@ class CommandLineTestCase(unittest.TestCase):
# reset to default before running the test, # reset to default before running the test,
# as the first two runs don't use setlocale() # as the first two runs don't use setlocale()
try: try:
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') locale.setlocale(locale.LC_ALL, 'C.UTF-8')
except locale.Error: except locale.Error:
self.skipTest('locale en_US.UTF-8 not available') self.skipTest('locale C.UTF-8 not available')
locale.setlocale(locale.LC_ALL, (None, None)) locale.setlocale(locale.LC_ALL, (None, None))
# C + en.yaml should fail # C + en.yaml should fail