Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
dmt
Commits
1217039e
Commit
1217039e
authored
Apr 24, 2017
by
Thanassis Tsiodras
Browse files
Adding SQLAlchemy tests to CircleCI suite
parent
e6e698e3
Changes
432
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
1217039e
...
...
@@ -8,7 +8,7 @@ PY_SRC:=$(filter-out dmt/B_mappers/antlr.main.py dmt/A_mappers/Stubs.py, ${PY_SR
TYPING_FOLDER
:=
$(
shell
pip3 show typing |
grep
^Location |
sed
's,^.*: ,,'
)
export
PYTHONPATH
=
${TYPING_FOLDER}
all
:
flake8 pylint mypy coverage
all
:
flake8 pylint mypy coverage
testDB
flake8
:
@
echo
Performing syntax checks via flake8...
...
...
@@ -26,4 +26,8 @@ coverage:
@
echo
Performing coverage checks...
@
$(MAKE)
-C
tests-coverage
||
exit
1
testDB
:
@
echo
Performing database tests...
@
$(MAKE)
-C
tests-sqlalchemy
||
exit
1
.PHONY
:
flake8 pylint mypy coverage
tests-sqlalchemy/LotsOfDataTypes.asn
0 → 100644
View file @
1217039e
MY-MODULE DEFINITIONS AUTOMATIC TAGS ::= BEGIN
-- Original definition by Alain
--T-POS ::= BOOLEAN
MyInt ::= INTEGER (0 .. 20)
My2ndInt ::= MyInt ( 1 .. 18)
MySeq ::= SEQUENCE {
anInt MyInt,
anotherInt My2ndInt
}
MyChoice ::= CHOICE {
anInt MyInt,
aReal REAL (0.0 .. 10.0)
}
AType ::= SEQUENCE {
blArray SEQUENCE (SIZE(10)) OF BOOLEAN
}
MySuperSeq ::= SEQUENCE {
aSeq MySeq,
anotherSeq MySeq,
anArray T-ARR3,
aString OCTET STRING (SIZE(1..10))
}
My2ndAType ::= AType
TypeEnumerated ::= ENUMERATED {
red(0),
green(1),
blue(2)
}
My2ndEnumerated ::= TypeEnumerated
TypeNested ::= SEQUENCE {
intVal INTEGER(0..10),
int2Val INTEGER(-10..10),
int3Val MyInt (10..12),
intArray SEQUENCE (SIZE (10)) OF INTEGER (0..3),
realArray SEQUENCE (SIZE (10)) OF REAL (0.1 .. 3.14),
octStrArray SEQUENCE (SIZE (10)) OF OCTET STRING (SIZE(1..10)),
boolArray SEQUENCE (SIZE (10)) OF T-BOOL,
enumArray SEQUENCE (SIZE (10)) OF TypeEnumerated,
enumValue TypeEnumerated,
enumValue2 ENUMERATED {
truism(0),
falsism(1)
},
label OCTET STRING (SIZE(10..40)),
bAlpha T-BOOL,
bBeta BOOLEAN,
sString T-STRING,
arr T-ARR,
arr2 T-ARR2
}
My2ndTypeNested ::= TypeNested
T-POS ::= CHOICE {
longitude REAL(-180.0..180.0),
latitude REAL(-90.0..90.0),
height REAL(30000.0..45000.0),
subTypeArray SEQUENCE (SIZE(10..15)) OF TypeNested,
label OCTET STRING (SIZE(50)),
intArray T-ARR,
myIntSet T-SET,
myIntSetOf T-SETOF,
anInt My2ndInt
}
T-POS-SET ::= SET {
longitude REAL(-180.0..180.0),
latitude REAL(-90.0..90.0),
height REAL(30000.0..45000.0),
subTypeArray SEQUENCE (SIZE(10..15)) OF TypeNested,
label OCTET STRING (SIZE(20..50)),
intArray T-ARR,
myIntSet T-SET,
myIntSetOf T-SETOF
}
T-ARR ::= SEQUENCE (SIZE (5..6)) OF INTEGER (0..32764)
My2ndArr ::= T-ARR
T-ARR2 ::= SEQUENCE (SIZE (5..6)) OF REAL (0.1 .. 4.2)
T-ARR3 ::= SEQUENCE (SIZE (5..6)) OF SEQUENCE (SIZE(7)) OF REAL (0.1 .. 39.2)
T-ARR4 ::= SEQUENCE (SIZE (5..6)) OF SEQUENCE (SIZE(7)) OF REAL (0.1 .. 4.3)
T-SET ::= SET {
data1 INTEGER(0..131071),
data2 REAL(-100.0 .. 10.0),
data3 INTEGER(-1024..1024),
data4 INTEGER(-1310720..131071)
}
T-SETOF ::= SET (SIZE (5..6)) OF INTEGER (0..4)
T-BOOL ::= BOOLEAN
My2ndBool ::= T-BOOL
T-INT ::= INTEGER (0..50)
T-REAL ::= REAL (-3.14..3.14)
My2ndReal ::= T-REAL
T-STRING ::= OCTET STRING (SIZE(10..15))
My2ndString ::= T-STRING
T-FIXEDSTRING ::= OCTET STRING (SIZE(15))
T-META ::= T-POS
END
tests-sqlalchemy/Makefile
0 → 100644
View file @
1217039e
all
:
cleanDB test
cleanDB
:
# PostgreSQL
echo
'drop database circle_test; create database circle_test;'
| psql
-h
127.0.0.1
-U
ubuntu postgres
||
exit
1
rm
-f
sql.log
#
# MySQL
(
is a toy - disabled related tests
)
# echo 'drop database test; create database test;' | mysql -u taste || exit 1
#
# SQLite
rm
-f
test.db
clean
:
rm
-rf
verifier/asn2dataModel verifier/lotsofdatatypes_model.
*
*
/
*
.pyc verifier/LotsOfDataTypes.asn .coverage
$(MAKE)
cleanDB
build
:
cd
verifier/
;
if
[
!
-d
asn2dataModel
]
;
then
mkdir
-p
asn2dataModel
;
[
!
-h
LotsOfDataTypes.asn
]
&&
ln
-s
../LotsOfDataTypes.asn
;
LC_ALL
=
C asn2dataModel
-o
asn2dataModel
-toPython
LotsOfDataTypes.asn
;
fi
cd
verifier/asn2dataModel
||
exit
1
&&
make
-f
Makefile.python
cd
verifier
;
LC_ALL
=
C asn2dataModel
-toSqlalchemy
-o
asn2dataModel/ LotsOfDataTypes.asn
touch
verifier/asn2dataModel/__init__.py
debug
:
|build
ipdb
-m
verifier.testSQLengines.py
test
:
|build
python
-m
verifier.testSQLengines
print
:
@
for
i
in
MyInt My2ndInt MySeq MyChoice TypeEnumerated MySuperSeq T_ARR T_ARR_indexes T_ARR_elm
;
do
\
echo
"========"
;
\
echo
PostgreSQL Content of
$$
i
;
\
echo
"========"
;
\
echo
"select * from
\"
$$
i
\"
"
| psql
-h
127.0.0.1
-U
ubuntu circle_test
;
\
done
# @for i in MyInt My2ndInt MySeq MyChoice TypeEnumerated MySuperSeq T_ARR T_ARR_indexes T_ARR_elm ; do \
# echo "========" ; \
# echo MySQL Content of $$i ; \
# echo "========" ; \
# echo "select * from $$i " | mysql -u taste test ; \
# done | less
@for
i
in
MyInt
My2ndInt
MySeq
MyChoice
TypeEnumerated
MySuperSeq
T_ARR
T_ARR_indexes
T_ARR_elm
;
do
\
echo
"========"
;
\
echo
SQLite
Content
of
$$i
;
\
echo
"========"
;
\
echo
"select * from $$i ;"
|
sqlite3
test.db
;
\
done
tests-sqlalchemy/diagram.py
0 → 100644
View file @
1217039e
from
sqlalchemy
import
MetaData
from
sqlalchemy_schemadisplay
import
create_schema_graph
# create the pydot graph object by autoloading all tables via a bound metadata object
graph
=
create_schema_graph
(
metadata
=
MetaData
(
'postgresql+psycopg2://taste:tastedb@localhost/test'
),
show_datatypes
=
False
,
# The image would get nasty big if we'd show the datatypes
show_indexes
=
False
,
# ditto for indexes
rankdir
=
'LR'
,
# From left to right (instead of top to bottom)
concentrate
=
False
# Don't try to join the relation lines together
)
graph
.
write_png
(
'/home/assert/Desktop/C_DRIVE/work/dbschema.png'
)
# write out the file
tests-sqlalchemy/sqlalchemy_schemadisplay/ChangeLog
0 → 100644
View file @
1217039e
2004-04-28 21:50 carrer
* pydot.py: Some of the changes already made should allow pydot to
run on OSX. Bumped version to 0.9.2
2004-04-24 17:52 carrer
* setup.py: Added more metainformation to the distribution.
2004-04-24 17:51 carrer
* pydot.py: Added support for circo and fdp. Fixed piping mechanism
to not to capture stderr.
2004-04-24 13:26 carrer
* ChangeLog, LICENSE, MANIFEST, README, setup.py: Adding
suplementary files to the distribution to the CVS.
2004-04-24 12:57 carrer
* pydot.py: Bumped version to 0.9.1
2004-04-24 01:36 carrer
* pydot.py: Implemented tweaks suggested by John B. Cole to handle
non-str nodes, converting them to strings.
2004-04-24 01:10 carrer
* pydot.py: Applied patch for Windows support by Kent Johnson.
2004-04-24 01:05 carrer
* pydot.py: Fixed to properly handle unicode strings in attributes.
2004-04-20 00:06 carrer
* pydot.py:
Fixed silly error in graph_from_edges. When pasting the function
into the code, the references to the pydot module were not
removed, which are no longer needed since we now are _in_ the
module.
2004-04-19 23:33 carrer
* pydot.py:
Added support to write files with the desired output format with
write_[format]
2004-04-19 22:53 carrer
* pydot.py:
Done some clean up, no major changes.
2004-04-08 00:22 carrer
* pydot.py:
Initial revision.
2004-04-08 00:22 carrer
* pydot.py: Initial revision
tests-sqlalchemy/sqlalchemy_schemadisplay/LICENSE
0 → 100644
View file @
1217039e
Copyright (c) 2004 Ero Carrera
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
tests-sqlalchemy/sqlalchemy_schemadisplay/README
0 → 100644
View file @
1217039e
pydot - Python interface to Graphviz's Dot language
Ero Carrera (c) 2004-2007
ero@dkbza.org
This code is distributed under the MIT license.
Requirements:
-------------
pyparsing: pydot requires the pyparsing module in order to be
able to load DOT files.
GraphViz: is needed in order to render the graphs into any of
the plethora of output formats supported.
Installation:
-------------
Should suffice with doing:
python setup.py install
Needless to say, no installation is needed just to use the module. A mere:
import pydot
should do it, provided that the directory containing the modules is on Python
module search path.
tests-sqlalchemy/sqlalchemy_schemadisplay/bin/activate
0 → 100644
View file @
1217039e
# This file must be used with "source bin/activate" *from bash*
# you cannot run it directly
deactivate () {
unset pydoc
# reset old environment variables
if [ -n "$_OLD_VIRTUAL_PATH" ] ; then
PATH="$_OLD_VIRTUAL_PATH"
export PATH
unset _OLD_VIRTUAL_PATH
fi
if [ -n "$_OLD_VIRTUAL_PYTHONHOME" ] ; then
PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME"
export PYTHONHOME
unset _OLD_VIRTUAL_PYTHONHOME
fi
# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands. Without forgetting
# past commands the $PATH changes we made may not be respected
if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
hash -r 2>/dev/null
fi
if [ -n "$_OLD_VIRTUAL_PS1" ] ; then
PS1="$_OLD_VIRTUAL_PS1"
export PS1
unset _OLD_VIRTUAL_PS1
fi
unset VIRTUAL_ENV
if [ ! "$1" = "nondestructive" ] ; then
# Self destruct!
unset -f deactivate
fi
}
# unset irrelevant variables
deactivate nondestructive
VIRTUAL_ENV="/home/assert/tool-src/DMT/tests-sqlalchemy/sqlalchemy_schemadisplay"
export VIRTUAL_ENV
_OLD_VIRTUAL_PATH="$PATH"
PATH="$VIRTUAL_ENV/bin:$PATH"
export PATH
# unset PYTHONHOME if set
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
# could use `if (set -u; : $PYTHONHOME) ;` in bash
if [ -n "$PYTHONHOME" ] ; then
_OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME"
unset PYTHONHOME
fi
if [ -z "$VIRTUAL_ENV_DISABLE_PROMPT" ] ; then
_OLD_VIRTUAL_PS1="$PS1"
if [ "x" != x ] ; then
PS1="$PS1"
else
if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
# special case for Aspen magic directories
# see http://www.zetadev.com/software/aspen/
PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1"
else
PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1"
fi
fi
export PS1
fi
alias pydoc="python -m pydoc"
# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands. Without forgetting
# past commands the $PATH changes we made may not be respected
if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
hash -r 2>/dev/null
fi
tests-sqlalchemy/sqlalchemy_schemadisplay/bin/activate.csh
0 → 100644
View file @
1217039e
# This file must be used with "source bin/activate.csh" *from csh*.
# You cannot run it directly.
# Created by Davide Di Blasi <davidedb@gmail.com>.
alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate && unalias pydoc'
# Unset irrelevant variables.
deactivate nondestructive
setenv VIRTUAL_ENV "/home/assert/tool-src/DMT/tests-sqlalchemy/sqlalchemy_schemadisplay"
set _OLD_VIRTUAL_PATH="$PATH"
setenv PATH "$VIRTUAL_ENV/bin:$PATH"
if ("" != "") then
set env_name = ""
else
if (`basename "$VIRTUAL_ENV"` == "__") then
# special case for Aspen magic directories
# see http://www.zetadev.com/software/aspen/
set env_name = `basename \`dirname "$VIRTUAL_ENV"\``
else
set env_name = `basename "$VIRTUAL_ENV"`
endif
endif
# Could be in a non-interactive environment,
# in which case, $prompt is undefined and we wouldn't
# care about the prompt anyway.
if ( $?prompt ) then
set _OLD_VIRTUAL_PROMPT="$prompt"
set prompt = "[$env_name] $prompt"
endif
unset env_name
alias pydoc python -m pydoc
rehash
tests-sqlalchemy/sqlalchemy_schemadisplay/bin/activate.fish
0 → 100644
View file @
1217039e
# This file must be used with "source bin/activate.fish" *from fish* (http://fishshell.com)
# you cannot run it directly
function deactivate -d "Exit virtualenv and return to normal shell environment"
# reset old environment variables
if test -n "$_OLD_VIRTUAL_PATH"
set -gx PATH $_OLD_VIRTUAL_PATH
set -e _OLD_VIRTUAL_PATH
end
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
set -e _OLD_VIRTUAL_PYTHONHOME
end
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
# set an empty local fish_function_path, so fish_prompt doesn't automatically reload
set -l fish_function_path
# erase the virtualenv's fish_prompt function, and restore the original
functions -e fish_prompt
functions -c _old_fish_prompt fish_prompt
functions -e _old_fish_prompt
set -e _OLD_FISH_PROMPT_OVERRIDE
end
set -e VIRTUAL_ENV
if test "$argv[1]" != "nondestructive"
# Self destruct!
functions -e deactivate
end
end
# unset irrelevant variables
deactivate nondestructive
set -gx VIRTUAL_ENV "/home/assert/tool-src/DMT/tests-sqlalchemy/sqlalchemy_schemadisplay"
set -gx _OLD_VIRTUAL_PATH $PATH
set -gx PATH "$VIRTUAL_ENV/bin" $PATH
# unset PYTHONHOME if set
if set -q PYTHONHOME
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
set -e PYTHONHOME
end
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
# fish uses a function instead of an env var to generate the prompt.
# copy the current fish_prompt function as the function _old_fish_prompt
functions -c fish_prompt _old_fish_prompt
# with the original prompt function copied, we can override with our own.
function fish_prompt
# Prompt override?
if test -n ""
printf "%s%s" "" (set_color normal)
_old_fish_prompt
return
end
# ...Otherwise, prepend env
set -l _checkbase (basename "$VIRTUAL_ENV")
if test $_checkbase = "__"
# special case for Aspen magic directories
# see http://www.zetadev.com/software/aspen/
printf "%s[%s]%s " (set_color -b blue white) (basename (dirname "$VIRTUAL_ENV")) (set_color normal)
_old_fish_prompt
else
printf "%s(%s)%s" (set_color -b blue white) (basename "$VIRTUAL_ENV") (set_color normal)
_old_fish_prompt
end
end
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
end
tests-sqlalchemy/sqlalchemy_schemadisplay/bin/activate_this.py
0 → 100644
View file @
1217039e
"""By using execfile(this_file, dict(__file__=this_file)) you will
activate this virtualenv environment.
This can be used when you must use an existing Python interpreter, not
the virtualenv bin/python
"""
try
:
__file__
except
NameError
:
raise
AssertionError
(
"You must run this like execfile('path/to/activate_this.py', dict(__file__='path/to/activate_this.py'))"
)
import
sys
import
os
old_os_path
=
os
.
environ
[
'PATH'
]
os
.
environ
[
'PATH'
]
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
+
os
.
pathsep
+
old_os_path
base
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))
if
sys
.
platform
==
'win32'
:
site_packages
=
os
.
path
.
join
(
base
,
'Lib'
,
'site-packages'
)
else
:
site_packages
=
os
.
path
.
join
(
base
,
'lib'
,
'python%s'
%
sys
.
version
[:
3
],
'site-packages'
)
prev_sys_path
=
list
(
sys
.
path
)
import
site
site
.
addsitedir
(
site_packages
)
sys
.
real_prefix
=
sys
.
prefix
sys
.
prefix
=
base
# Move the added items to the front of the path:
new_sys_path
=
[]
for
item
in
list
(
sys
.
path
):
if
item
not
in
prev_sys_path
:
new_sys_path
.
append
(
item
)
sys
.
path
.
remove
(
item
)
sys
.
path
[:
0
]
=
new_sys_path
tests-sqlalchemy/sqlalchemy_schemadisplay/bin/easy_install
0 → 100755
View file @
1217039e
#!/home/assert/tool-src/DMT/tests-sqlalchemy/sqlalchemy_schemadisplay/bin/python2
# -*- coding: utf-8 -*-
import
re
import
sys
from
setuptools.command.easy_install
import
main
if
__name__
==
'__main__'
:
sys
.
argv
[
0
]
=
re
.
sub
(
r
'(-script\.pyw|\.exe)?$'
,
''
,
sys
.
argv
[
0
])
sys
.
exit
(
main
())
tests-sqlalchemy/sqlalchemy_schemadisplay/bin/easy_install-2.7
0 → 100755
View file @
1217039e
#!/home/assert/tool-src/DMT/tests-sqlalchemy/sqlalchemy_schemadisplay/bin/python2
# -*- coding: utf-8 -*-
import
re
import
sys
from
setuptools.command.easy_install
import
main
if
__name__
==
'__main__'
:
sys
.
argv
[
0
]
=
re
.
sub
(
r
'(-script\.pyw|\.exe)?$'
,
''
,
sys
.
argv
[
0
])
sys
.
exit
(
main
())
tests-sqlalchemy/sqlalchemy_schemadisplay/bin/pip
0 → 100755
View file @
1217039e
#!/home/assert/tool-src/DMT/tests-sqlalchemy/sqlalchemy_schemadisplay/bin/python2
# -*- coding: utf-8 -*-
import
re
import
sys
from
pip
import
main
if
__name__
==
'__main__'
:
sys
.
argv
[
0
]
=
re
.
sub
(
r
'(-script\.pyw|\.exe)?$'
,
''
,
sys
.
argv
[
0
])
sys
.
exit
(
main
())
tests-sqlalchemy/sqlalchemy_schemadisplay/bin/pip2
0 → 100755
View file @
1217039e
#!/home/assert/tool-src/DMT/tests-sqlalchemy/sqlalchemy_schemadisplay/bin/python2
# -*- coding: utf-8 -*-
import
re
import
sys
from
pip
import
main
if
__name__
==
'__main__'
:
sys
.
argv
[
0
]
=
re
.
sub
(
r
'(-script\.pyw|\.exe)?$'
,
''
,
sys
.
argv
[
0
])
sys
.
exit
(
main
())
tests-sqlalchemy/sqlalchemy_schemadisplay/bin/pip2.7
0 → 100755
View file @
1217039e
#!/home/assert/tool-src/DMT/tests-sqlalchemy/sqlalchemy_schemadisplay/bin/python2
# -*- coding: utf-8 -*-
import
re
import
sys
from
pip
import
main
if
__name__
==
'__main__'
:
sys
.
argv
[
0
]
=
re
.
sub
(
r
'(-script\.pyw|\.exe)?$'
,
''
,
sys
.
argv
[
0
])
sys
.
exit
(
main
())
tests-sqlalchemy/sqlalchemy_schemadisplay/bin/python
0 → 120000
View file @
1217039e
python2
\ No newline at end of file
tests-sqlalchemy/sqlalchemy_schemadisplay/bin/python2
0 → 100755
View file @
1217039e
File added
tests-sqlalchemy/sqlalchemy_schemadisplay/bin/python2.7
0 → 120000
View file @
1217039e
python2
\ No newline at end of file