Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mutalyzer
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirrors
mutalyzer
Commits
cd9e05ee
Commit
cd9e05ee
authored
9 years ago
by
Vermaat
Browse files
Options
Downloads
Plain Diff
Merge pull request #88 from mutalyzer/travis-env
Travis CI updates
parents
1cdee126
0963de07
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.travis.yml
+15
-5
15 additions, 5 deletions
.travis.yml
doc/testing.rst
+3
-0
3 additions, 0 deletions
doc/testing.rst
tests/utils.py
+6
-1
6 additions, 1 deletion
tests/utils.py
with
24 additions
and
6 deletions
.travis.yml
+
15
−
5
View file @
cd9e05ee
# Validate this file using http://lint.travis-ci.org/
language
:
python
addons
:
postgresql
:
"
9.4"
services
:
-
redis-server
python
:
-
"
2.7"
env
:
global
:
-
MUTALYZER_TEST_REDIS_URI=redis://localhost
matrix
:
-
MUTALYZER_TEST_DATABASE_URI=sqlite://
-
MUTALYZER_TEST_DATABASE_URI=postgres://postgres@127.0.0.1/mutalyzer_test
-
MUTALYZER_TEST_DATABASE_URI=mysql://travis@127.0.0.1/mutalyzer_test?charset=utf8
before_install
:
-
sudo apt-get update -qq
-
sudo apt-get install -y swig
-
pip install -r requirements.txt
-
pip install psycopg2
-
bash -c "if [[ '$MUTALYZER_TEST_DATABASE_URI' =~ 'postgres' ]]; then
pip install psycopg2
; fi"
install
:
-
pip install .
before_script
:
-
psql -c 'create database mutalyzer_test;' -U postgres
-
mysql -e 'create database mutalyzer_test;'
-
bash -c "if [[ '$MUTALYZER_TEST_DATABASE_URI' =~ 'postgres' ]]; then psql -c 'DROP DATABASE IF EXISTS mutalyzer_test;' -U postgres; fi"
-
bash -c "if [[ '$MUTALYZER_TEST_DATABASE_URI' =~ 'postgres' ]]; then psql -c 'CREATE DATABASE mutalyzer_test;' -U postgres; fi"
-
bash -c "if [[ '$MUTALYZER_TEST_DATABASE_URI' =~ 'mysql' ]]; then mysql -e 'CREATE DATABASE IF NOT EXISTS mutalyzer_test;'; fi"
script
:
-
py.test
-
MUTALYZER_TEST_DATABASE_URI=postgres://postgres@127.0.0.1/mutalyzer_test py.test
-
MUTALYZER_TEST_DATABASE_URI=mysql://travis@127.0.0.1/mutalyzer_test?charset=utf8 py.test
This diff is collapsed.
Click to expand it.
doc/testing.rst
+
3
−
0
View file @
cd9e05ee
...
...
@@ -31,6 +31,9 @@ PostgreSQL::
$ pg_virtualenv bash -c 'MUTALYZER_TEST_DATABASE_URI=postgres://${PGUSER}:${PGPASSWORD}@${PGHOST}:${PGPORT}/${PGDATABASE} py.test'
Similarly, the `MUTALYZER_TEST_REDIS_URI` specifies a Redis server to use for
testing. If unspecified, a mock Redis server is used.
Tests are `run automatically on Travis CI
<https://travis-ci.org/mutalyzer/mutalyzer>`_ with SQLite, PostgreSQL, and
MySQL, for each pull request and push on GitHub.
...
...
This diff is collapsed.
Click to expand it.
tests/utils.py
+
6
−
1
View file @
cd9e05ee
...
...
@@ -11,6 +11,7 @@ import shutil
import
tempfile
from
mutalyzer.config
import
settings
from
mutalyzer.redisclient
import
client
as
redis
from
mutalyzer
import
db
...
...
@@ -27,11 +28,12 @@ class TestEnvironment(object):
os
.
close
(
log_handle
)
database_uri
=
os
.
getenv
(
'
MUTALYZER_TEST_DATABASE_URI
'
,
'
sqlite://
'
)
redis_uri
=
os
.
getenv
(
'
MUTALYZER_TEST_REDIS_URI
'
,
None
)
settings
.
configure
({
'
DEBUG
'
:
False
,
'
TESTING
'
:
True
,
'
CACHE_DIR
'
:
self
.
cache_dir
,
'
REDIS_URI
'
:
None
,
'
REDIS_URI
'
:
redis_uri
,
'
DATABASE_URI
'
:
database_uri
,
'
LOG_FILE
'
:
self
.
log_file
})
...
...
@@ -41,6 +43,9 @@ class TestEnvironment(object):
db
.
Base
.
metadata
.
drop_all
(
db
.
session
.
get_bind
())
db
.
Base
.
metadata
.
create_all
(
db
.
session
.
get_bind
())
if
redis_uri
is
not
None
:
redis
.
flushdb
()
for
fixture
in
fixtures
:
fixture
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment