Migrate io-tests from bash to pytest

Authored-by: monacoremo <monacoremo>
This commit is contained in:
Remo Rechkemmer
2020-12-13 16:19:26 +01:00
committed by GitHub
parent 0c25f12825
commit 71fa87937b
8 changed files with 419 additions and 434 deletions
+5 -1
View File
@@ -1,4 +1,5 @@
{ buildEnv
{ black
, buildEnv
, checkedShellScript
, git
, hlint
@@ -19,6 +20,9 @@ let
# --vimgrep fixes a bug in ag: https://github.com/ggreer/the_silver_searcher/issues/753
${silver-searcher}/bin/ag -l --vimgrep -g '\.l?hs$' . "$rootdir" \
| xargs ${stylish-haskell}/bin/stylish-haskell -i
# Format Python files
${black}/bin/black "$rootdir" 2> /dev/null
'';
# Script to check whether any uncommited changes result from postgrest-style
+14 -3
View File
@@ -15,6 +15,7 @@
, postgrestStatic
, postgrestProfiled
, procps
, python3
, runtimeShell
}:
let
@@ -74,19 +75,29 @@ let
checkedShellScript "postgrest-test-spec-all"
(lib.concatStringsSep "\n" testRunners);
ioTestPython =
python3.withPackages (ps: [
ps.pytest
ps.requests
ps.requests-unixsocket
ps.pyjwt
ps.pyyaml
]);
testIO =
name: postgresql:
checkedShellScript
name
''
env="$(cat ${postgrest.env})"
export PATH="$env/bin:${curl}/bin:${procps}/bin:${diffutils}/bin:$PATH"
export PATH="$env/bin:$PATH"
rootdir="$(${git}/bin/git rev-parse --show-toplevel)"
cd "$rootdir"
${cabal-install}/bin/cabal v2-build ${devCabalOptions}
${cabal-install}/bin/cabal v2-exec ${withTmpDb postgresql} "$rootdir"/test/io-tests.sh
${cabal-install}/bin/cabal v2-exec ${withTmpDb postgresql} \
${ioTestPython}/bin/pytest -- -v "$rootdir"/test/io-tests "$@"
'';
testMemory =
@@ -117,7 +128,7 @@ buildEnv
] ++ testSpecVersions;
}
# The memory tests have large dependencies (a profiled build of PostgREST)
# and are run less often than the spec tests, so we don't include them in
# and are run less often than the spec tests, so we don't include them in
# the default test environment. We make them available through a separate attribute:
// {
memoryTests =