Skip to content

Commit

Permalink
Merge ebf03a8 into 0c25f12
Browse files Browse the repository at this point in the history
  • Loading branch information
monacoremo committed Dec 13, 2020
2 parents 0c25f12 + ebf03a8 commit 1bc696f
Show file tree
Hide file tree
Showing 8 changed files with 418 additions and 433 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -17,3 +17,4 @@ result*
dist-newstyle
postgrest.hp
postgrest.prof
__pycache__
5 changes: 4 additions & 1 deletion .travis.yml
Expand Up @@ -87,6 +87,8 @@ jobs:
update: true
packages:
- postgresql-12
- python3
- python3-pip
cache:
yarn: true
timeout: 1000
Expand All @@ -107,11 +109,12 @@ jobs:
fi
travis_wait stack --no-terminal setup
travis_wait stack --no-terminal install hpc
pip3 install pytest pyyaml requests requests-unixsocket pyjwt
script: |
travis_wait 50 stack --no-terminal build --fast -j1 --coverage
travis_wait 50 stack --no-terminal build --fast -j1 --coverage --test --no-run-tests
test/with_tmp_db stack --no-terminal test --coverage
test/with_tmp_db stack --no-terminal exec test/io-tests.sh
test/with_tmp_db stack --no-terminal exec -- pytest -v test/io-tests
after_script: |
export _HPC_DIR=$(stack path --local-hpc-root)
export _MIX_DIR=$(stack path --dist-dir)
Expand Down
6 changes: 5 additions & 1 deletion nix/style.nix
@@ -1,4 +1,5 @@
{ buildEnv
{ black
, buildEnv
, checkedShellScript
, git
, hlint
Expand All @@ -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
Expand Down
17 changes: 14 additions & 3 deletions nix/tests.nix
Expand Up @@ -15,6 +15,7 @@
, postgrestStatic
, postgrestProfiled
, procps
, python3
, runtimeShell
}:
let
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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 =
Expand Down

0 comments on commit 1bc696f

Please sign in to comment.