Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Odoo scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XCG
Odoo scripts
Commits
8f0517d4
Commit
8f0517d4
authored
7 years ago
by
Brendan Masson
Browse files
Options
Downloads
Patches
Plain Diff
Allow overriding DB user in run_tests
parent
e28ad724
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
run_tests
+8
-1
8 additions, 1 deletion
run_tests
with
8 additions
and
1 deletion
run_tests
+
8
−
1
View file @
8f0517d4
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
# This script is used to run tests on a database with demo data installed.
# This script is used to run tests on a database with demo data installed.
#
#
# Either provide the name of the database (first argument) or it will default to <project>_test
# Either provide the name of the database (first argument) or it will default to <project>_test
# The DB user can be overriden by setting ODOO_SCRIPTS_DB_USER.
# Version 2.10
# Version 2.10
here
=
$(
dirname
$0
)
here
=
$(
dirname
$0
)
project_home
=
$(
cd
$here
&&
cd
..
&&
echo
$PWD
)
project_home
=
$(
cd
$here
&&
cd
..
&&
echo
$PWD
)
...
@@ -21,6 +22,12 @@
...
@@ -21,6 +22,12 @@
fi
fi
echo
"Using database
$dbname
for tests"
echo
"Using database
$dbname
for tests"
if
[[
-n
"
$ODOO_SCRIPTS_DB_USER
"
]]
then
echo
"Using db user
$ODOO_SCRIPTS_DB_USER
"
db_user_param
=
"--db_user
$ODOO_SCRIPTS_DB_USER
"
fi
ODOO_TYPE
=
$(
python
-B
-c
"import ConfigParser ; c = ConfigParser.ConfigParser() ; c.read('
${
project_home
}
/setup.cfg') ; print c.get('odoo_scripts', 'odoo_type', 'odoo8')"
)
ODOO_TYPE
=
$(
python
-B
-c
"import ConfigParser ; c = ConfigParser.ConfigParser() ; c.read('
${
project_home
}
/setup.cfg') ; print c.get('odoo_scripts', 'odoo_type', 'odoo8')"
)
if
[
"
$ODOO_TYPE
"
=
"odoo8"
]
;
if
[
"
$ODOO_TYPE
"
=
"odoo8"
]
;
then
then
...
@@ -29,7 +36,7 @@
...
@@ -29,7 +36,7 @@
loglevel
=
"--log-level=test"
loglevel
=
"--log-level=test"
fi
fi
logfile
=
$(
tempfile
--suffix
=
.log
)
logfile
=
$(
tempfile
--suffix
=
.log
)
$here
/start
$update
-d
$dbname
--test-enable
$loglevel
--max-cron
=
0
--stop-after-init
$*
|
tee
$logfile
|
sed
-e
's/\(.*\) \(INFO\) \(.*\)/\o033[2m\1\o033[22m \o033[32m\o033[7m\2\o033[27m \3\o033[39m/'
-e
's/\(.*\) \(DEBUG\) \(.*\)/\1 \o033[33m\o033[7m\2\o033[27m \2\o033[39m/'
-e
's/\(.*\) \(WARNING\) \(.*\)/\o033[2m\1\o033[22m \o033[33m\o033[7m\2\o033[27m \3\o033[39m/'
-e
's/\(.*\) \(ERROR\) \(.*\)/\1 \o033[31m\o033[7m\2\o033[27m \3\o033[0m/'
-e
's/\(.*\) \(TEST\) \(.*\)/\1 \o033[34m\o033[7m\2\o033[27m \3 \o033[0m/'
-e
's/ FAILED/ \o033[41m\o033[97m\o033[1mFAILED\o033[0m/'
-e
's/ FAIL\(.*\)/ \o033[41m\o033[97m\o033[1mFAIL\o033[49m\o033[31m\1\o033[0m/'
$here
/start
$update
-d
$dbname
$db_user_param
--test-enable
$loglevel
--max-cron
=
0
--stop-after-init
$*
|
tee
$logfile
|
sed
-e
's/\(.*\) \(INFO\) \(.*\)/\o033[2m\1\o033[22m \o033[32m\o033[7m\2\o033[27m \3\o033[39m/'
-e
's/\(.*\) \(DEBUG\) \(.*\)/\1 \o033[33m\o033[7m\2\o033[27m \2\o033[39m/'
-e
's/\(.*\) \(WARNING\) \(.*\)/\o033[2m\1\o033[22m \o033[33m\o033[7m\2\o033[27m \3\o033[39m/'
-e
's/\(.*\) \(ERROR\) \(.*\)/\1 \o033[31m\o033[7m\2\o033[27m \3\o033[0m/'
-e
's/\(.*\) \(TEST\) \(.*\)/\1 \o033[34m\o033[7m\2\o033[27m \3 \o033[0m/'
-e
's/ FAILED/ \o033[41m\o033[97m\o033[1mFAILED\o033[0m/'
-e
's/ FAIL\(.*\)/ \o033[41m\o033[97m\o033[1mFAIL\o033[49m\o033[31m\1\o033[0m/'
ok
=
$(
grep
' OK'
$logfile
-c
)
ok
=
$(
grep
' OK'
$logfile
-c
)
# TODO detect yaml tests failures
# TODO detect yaml tests failures
failed
=
$(
grep
' FAILED'
$logfile
-c
)
failed
=
$(
grep
' FAILED'
$logfile
-c
)
...
...
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