Skip to content

Commit

Permalink
Add language to the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Kelly committed Apr 25, 2017
1 parent a3abeb0 commit d2986dc
Showing 1 changed file with 52 additions and 40 deletions.
92 changes: 52 additions & 40 deletions buildbot_travis/tests/test_travisyml.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ def test_singleenv(self):

self.t.parse_matrix()
self.assertEqual(
self.t.matrix, [dict(python="2.7", env=dict(FOO='1', BAR='2'), os='linux', dist='precise'), ])
self.t.matrix, [dict(python="2.7", env=dict(FOO='1', BAR='2'),
os='linux', dist='precise', language='python'), ])

def test_multienv(self):
self.t.config["env"] = ["FOO=1 BAR=2", "FOO=2 BAR=1"]
Expand All @@ -114,8 +115,10 @@ def test_multienv(self):

self.t.parse_matrix()
self.assertEqual(self.t.matrix, [
dict(python="2.7", env=dict(FOO='1', BAR='2'), os='linux', dist='precise'),
dict(python="2.7", env=dict(FOO='2', BAR='1'), os='linux', dist='precise'),
dict(python="2.7", env=dict(FOO='1', BAR='2'), os='linux',
dist='precise', language='python'),
dict(python="2.7", env=dict(FOO='2', BAR='1'), os='linux',
dist='precise', language='python'),
])

def test_globalenv(self):
Expand All @@ -126,8 +129,10 @@ def test_globalenv(self):

self.t.parse_matrix()
self.assertEqual(self.t.matrix, [
dict(python="2.7", env=dict(FOOBAR='0', FOO='1', BAR='2'), os='linux', dist='precise'),
dict(python="2.7", env=dict(FOOBAR='0', FOO='2', BAR='1'), os='linux', dist='precise'),
dict(python="2.7", env=dict(FOOBAR='0', FOO='1', BAR='2'),
os='linux', dist='precise', language='python'),
dict(python="2.7", env=dict(FOOBAR='0', FOO='2', BAR='1'),
os='linux', dist='precise', language='python'),
])

def test_emptymatrixlenv(self):
Expand All @@ -138,7 +143,8 @@ def test_emptymatrixlenv(self):

self.t.parse_matrix()
self.assertEqual(self.t.matrix, [
dict(python="2.7", env=dict(FOOBAR='0'), os='linux', dist='precise'),
dict(python="2.7", env=dict(FOOBAR='0'), os='linux',
dist='precise', language='python'),
])


Expand All @@ -148,16 +154,16 @@ def test_default_language(self):
matrix = self.t._build_matrix()

self.failUnlessEqual(matrix, [
dict(python="2.7"),
dict(language='python', python="2.7"),
])

def test_default_multiple_options(self):
self.t.config["python"] = ['2.7', '3.5']
matrix = self.t._build_matrix()

self.failUnlessEqual(matrix, [
dict(python="2.7"),
dict(python="3.5"),
dict(language='python', python="2.7"),
dict(language='python', python="3.5"),
])

def test_language_with_dict(self):
Expand All @@ -172,7 +178,7 @@ def test_language_with_dict(self):
matrix = self.t._build_matrix()

self.failUnlessEqual(matrix, [
dict(compiler='gcc'),
dict(compiler='gcc', language='c'),
])

# Now try again with multiple compilers to use.
Expand All @@ -181,9 +187,9 @@ def test_language_with_dict(self):
matrix = self.t._build_matrix()

self.failUnlessEqual(matrix, [
dict(compiler='gcc'),
dict(compiler='clang'),
dict(compiler='cc'),
dict(compiler='gcc', language='c'),
dict(compiler='clang', language='c'),
dict(compiler='cc', language='c'),
])

def test_language_multiple_options(self):
Expand All @@ -202,7 +208,7 @@ def test_language_multiple_options(self):
matrix = self.t._build_matrix()

self.failUnlessEqual(matrix, [
dict(gemfile='Gemfile', jdk='openjdk7', rvm='2.2'),
dict(gemfile='Gemfile', jdk='openjdk7', rvm='2.2', language='ruby'),
])

# Start exploding the matrix
Expand All @@ -211,58 +217,58 @@ def test_language_multiple_options(self):
matrix = self.t._build_matrix()

self.failUnlessEqual(matrix, [
dict(gemfile='Gemfile', jdk='openjdk7', rvm='2.2'),
dict(gemfile='gemfiles/a', jdk='openjdk7', rvm='2.2'),
dict(gemfile='Gemfile', jdk='openjdk7', rvm='2.2', language='ruby'),
dict(gemfile='gemfiles/a', jdk='openjdk7', rvm='2.2', language='ruby'),
])

self.t.config["rvm"] = ['2.2', 'jruby']

matrix = self.t._build_matrix()

self.failUnlessEqual(matrix, [
dict(gemfile='Gemfile', jdk='openjdk7', rvm='2.2'),
dict(gemfile='Gemfile', jdk='openjdk7', rvm='jruby'),
dict(gemfile='gemfiles/a', jdk='openjdk7', rvm='2.2'),
dict(gemfile='gemfiles/a', jdk='openjdk7', rvm='jruby'),
dict(gemfile='Gemfile', jdk='openjdk7', rvm='2.2', language='ruby'),
dict(gemfile='Gemfile', jdk='openjdk7', rvm='jruby', language='ruby'),
dict(gemfile='gemfiles/a', jdk='openjdk7', rvm='2.2', language='ruby'),
dict(gemfile='gemfiles/a', jdk='openjdk7', rvm='jruby', language='ruby'),
])

self.t.config["jdk"] = ['openjdk7', 'oraclejdk7']

matrix = self.t._build_matrix()

self.failUnlessEqual(matrix, [
dict(gemfile='Gemfile', jdk='openjdk7', rvm='2.2'),
dict(gemfile='Gemfile', jdk='openjdk7', rvm='jruby'),
dict(gemfile='Gemfile', jdk='oraclejdk7', rvm='2.2'),
dict(gemfile='Gemfile', jdk='oraclejdk7', rvm='jruby'),
dict(gemfile='gemfiles/a', jdk='openjdk7', rvm='2.2'),
dict(gemfile='gemfiles/a', jdk='openjdk7', rvm='jruby'),
dict(gemfile='gemfiles/a', jdk='oraclejdk7', rvm='2.2'),
dict(gemfile='gemfiles/a', jdk='oraclejdk7', rvm='jruby'),
dict(gemfile='Gemfile', jdk='openjdk7', rvm='2.2', language='ruby'),
dict(gemfile='Gemfile', jdk='openjdk7', rvm='jruby', language='ruby'),
dict(gemfile='Gemfile', jdk='oraclejdk7', rvm='2.2', language='ruby'),
dict(gemfile='Gemfile', jdk='oraclejdk7', rvm='jruby', language='ruby'),
dict(gemfile='gemfiles/a', jdk='openjdk7', rvm='2.2', language='ruby'),
dict(gemfile='gemfiles/a', jdk='openjdk7', rvm='jruby', language='ruby'),
dict(gemfile='gemfiles/a', jdk='oraclejdk7', rvm='2.2', language='ruby'),
dict(gemfile='gemfiles/a', jdk='oraclejdk7', rvm='jruby', language='ruby'),
])


class TestOsMatrix(TravisYmlTestCase):

def test_os_matrix(self):
build_matrix = [dict(python='2.7')]
build_matrix = [dict(language='python', python='2.7')]

matrix = self.t._os_matrix(build_matrix)

self.failUnlessEqual(matrix, [
dict(os='linux', dist='precise', python='2.7')
dict(os='linux', dist='precise', language='python', python='2.7')
])

def test_multiple_dists(self):
build_matrix = [dict(python='2.7')]
build_matrix = [dict(language='python', python='2.7')]
self.t.config["dist"] = ["precise", "trusty", "xenial"]

matrix = self.t._os_matrix(build_matrix)

self.failUnlessEqual(matrix, [
dict(os='linux', dist='precise', python='2.7'),
dict(os='linux', dist='trusty', python='2.7'),
dict(os='linux', dist='xenial', python='2.7'),
dict(os='linux', dist='precise', language='python', python='2.7'),
dict(os='linux', dist='trusty', language='python', python='2.7'),
dict(os='linux', dist='xenial', language='python', python='2.7'),
])


Expand All @@ -277,7 +283,8 @@ def test_exclude_match(self):
self.t.parse_matrix()

self.assertEqual(self.t.matrix, [
dict(python="2.7", env=dict(FOO='1', BAR='2'), os='linux', dist='precise'),
dict(python="2.7", env=dict(FOO='1', BAR='2'), os='linux',
dist='precise', language='python'),
])

def test_exclude_subset_match(self):
Expand All @@ -289,7 +296,8 @@ def test_exclude_subset_match(self):
self.t.parse_matrix()

self.assertEqual(self.t.matrix, [
dict(python="2.7", env=dict(FOO='1', BAR='2'), os='linux', dist='precise'),
dict(python="2.7", env=dict(FOO='1', BAR='2'), os='linux',
dist='precise', language='python'),
])

def test_exclude_nomatch(self):
Expand All @@ -301,8 +309,10 @@ def test_exclude_nomatch(self):
self.t.parse_matrix()

self.assertEqual(self.t.matrix, [
dict(python="2.7", env=dict(FOO='1', BAR='2'), os='linux', dist='precise'),
dict(python="2.7", env=dict(FOO='2', BAR='1'), os='linux', dist='precise'),
dict(python="2.7", env=dict(FOO='1', BAR='2'), os='linux',
dist='precise', language='python'),
dict(python="2.7", env=dict(FOO='2', BAR='1'), os='linux',
dist='precise', language='python'),
])

def test_include(self):
Expand All @@ -314,8 +324,10 @@ def test_include(self):
self.t.parse_matrix()

self.assertEqual(self.t.matrix, [
dict(python="2.7", env=dict(FOO='1', BAR='2'), os='linux', dist='precise'),
dict(python="2.7", env=dict(FOO='2', BAR='1'), os='linux', dist='precise'),
dict(python="2.7", env=dict(FOO='1', BAR='2'), os='linux',
dist='precise', language='python'),
dict(python="2.7", env=dict(FOO='2', BAR='1'), os='linux',
dist='precise', language='python'),
dict(python="2.7", env=dict(FOO='2', BAR='3')),
])

Expand Down

0 comments on commit d2986dc

Please sign in to comment.