Skip to content

Commit

Permalink
tests update (#661)
Browse files Browse the repository at this point in the history
* bash update

* delete old

* udp2

* upd 3

* infer fix

* tests update 4

* codestyle

* tests update 5 - apex support

* simplified

* upd 7

* codestyle

* fix

* fox

* simplified

* s

* no segmentationns

* simplified gan

* gan without apex

* fix

* fix  2

* gan fix

* bash fix

* simplified

* +

* rl fix
  • Loading branch information
Scitator authored Feb 15, 2020
1 parent 0f0a7b0 commit fa6dffd
Show file tree
Hide file tree
Showing 70 changed files with 870 additions and 662 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ tmp/
logs/
# Examples - mock data
!examples/distilbert_text_classification/input/*.csv
!examples/_tests_distilbert_text_classification/input/*.csv
!examples/_tests_nlp_classification/input/*.csv
examples/logs/
notebooks/

Expand Down
27 changes: 15 additions & 12 deletions bin/_check_codestyle.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash
set -e

# Cause the script to exit if a single command fails
set -eo pipefail -v

# Parse -s flag which tells us that we should skip inplace yapf
echo 'parse -s flag'
Expand All @@ -14,27 +16,28 @@ echo 'isort: `isort -rc --check-only --settings-path ./setup.cfg`'
isort -rc --check-only --settings-path ./setup.cfg

# stop the build if there are any unexpected flake8 issues
echo 'flake8: `bash ./bin/flake8.sh`'
bash ./bin/flake8.sh --count \
echo 'flake8: `bash ./bin/_flake8.sh`'
bash ./bin/_flake8.sh --count \
--config=./setup.cfg \
--show-source \
--statistics

# exit-zero treats all errors as warnings.
echo 'flake8 (warnings): `flake8`'
flake8 . --count --exit-zero \
--max-complexity=10 \
echo 'flake8 (warnings): `bash ./bin/_flake8.sh`'
bash ./bin/_flake8.sh --count \
--config=./setup.cfg \
--statistics
--show-source \
--statistics \
--exit-zero

# test to make sure the code is yapf compliant
if [[ -f ${skip_inplace} ]]; then
echo 'yapf: `bash ./bin/yapf.sh --all`'
bash ./bin/yapf.sh --all
echo 'yapf: `bash ./bin/_yapf.sh --all`'
bash ./bin/_yapf.sh --all
else
echo 'yapf: `bash ./bin/yapf.sh --all-in-place`'
bash ./bin/yapf.sh --all-in-place
echo 'yapf: `bash ./bin/_yapf.sh --all-in-place`'
bash ./bin/_yapf.sh --all-in-place
fi

echo 'pytest: `pytest`'
pytest ./catalyst
pytest .
13 changes: 13 additions & 0 deletions bin/_flake8.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

# Cause the script to exit if a single command fails
set -eo pipefail -v

# this stops git rev-parse from failing if we run this from the .git directory
builtin cd "$(dirname "${BASH_SOURCE:-$0}")"

ROOT="$(git rev-parse --show-toplevel)"
builtin cd "$ROOT" || exit 1


flake8 "$@"
50 changes: 50 additions & 0 deletions bin/_yapf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash

# Cause the script to exit if a single command fails
set -eo pipefail -v

# this stops git rev-parse from failing if we run this from the .git directory
builtin cd "$(dirname "${BASH_SOURCE:-$0}")"

ROOT="$(git rev-parse --show-toplevel)"
builtin cd "$ROOT" || exit 1


YAPF_FLAGS=(
'--style' "$ROOT/setup.cfg"
'--recursive'
'--parallel'
)

YAPF_EXCLUDES=(
'--exclude' 'docker/*'
)

# Format specified files
format() {
yapf --in-place "${YAPF_FLAGS[@]}" -- "$@"
}

# Format all files, and print the diff to stdout for travis.
format_all() {
yapf --diff "${YAPF_FLAGS[@]}" "${YAPF_EXCLUDES[@]}" ./**/*.py
}

format_all_in_place() {
yapf --in-place "${YAPF_FLAGS[@]}" "${YAPF_EXCLUDES[@]}" ./**/*.py
}

# This flag formats individual files. --files *must* be the first command line
# arg to use this option.
if [[ "$1" == '--files' ]]; then
format "${@:2}"
# If `--all` is passed, then any further arguments are ignored and the
# entire python directory is formatted.
elif [[ "$1" == '--all' ]]; then
format_all
elif [[ "$1" == '--all-in-place' ]]; then
format_all_in_place
else
# Format only the files that changed in last commit.
exit 1
fi
20 changes: 0 additions & 20 deletions bin/flake8.sh

This file was deleted.

Loading

0 comments on commit fa6dffd

Please sign in to comment.