Skip to content

Commit

Permalink
refactored ivy_tests package (#13186)
Browse files Browse the repository at this point in the history
* refactored ivy_tests package

* update submodule index

* new line in conftest
  • Loading branch information
Aarsh2001 authored Mar 26, 2023
1 parent 67f2b3a commit 72bcd06
Show file tree
Hide file tree
Showing 25 changed files with 511 additions and 507 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

[submodule "ivy_tests/test_array_api"]
path = ivy_tests/test_array_api
[submodule "ivy_tests/array_api_testing/test_array_api"]
path = ivy_tests/array_api_testing/test_array_api
url = https://github.com/data-apis/array-api-tests.git
Empty file.
22 changes: 22 additions & 0 deletions ivy_tests/array_api_testing/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from pytest import mark
from pathlib import Path


skip_ids = []
skips_path = Path(__file__).parent / "skips.txt"
if skips_path.exists():
with open(skips_path) as f:
for line in f:
if line.startswith("ivy_tests"):
id_ = line.strip("\n")
skip_ids.append(id_)


def pytest_collection_modifyitems(items):
skip_ivy = mark.skip(reason="ivy skip - see ivy_tests/skips.txt for details")
for item in items:
# skip if specified in skips.txt
for id_ in skip_ids:
if item.nodeid.startswith(id_):
item.add_marker(skip_ivy)
break
482 changes: 482 additions & 0 deletions ivy_tests/array_api_testing/skips.txt

Large diffs are not rendered by default.

File renamed without changes.
22 changes: 2 additions & 20 deletions ivy_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
DirectoryBasedExampleDatabase,
)
from hypothesis.extra.redis import RedisExampleDatabase
from pytest import mark
from pathlib import Path



hypothesis_cache = os.getcwd() + "/.hypothesis/examples/"
Expand Down Expand Up @@ -118,21 +117,4 @@ def pytest_configure(config):
settings.load_profile("ivy_profile")


skip_ids = []
skips_path = Path(__file__).parent / "skips.txt"
if skips_path.exists():
with open(skips_path) as f:
for line in f:
if line.startswith("ivy_tests"):
id_ = line.strip("\n")
skip_ids.append(id_)


def pytest_collection_modifyitems(items):
skip_ivy = mark.skip(reason="ivy skip - see ivy_tests/skips.txt for details")
for item in items:
# skip if specified in skips.txt
for id_ in skip_ids:
if item.nodeid.startswith(id_):
item.add_marker(skip_ivy)
break

482 changes: 0 additions & 482 deletions ivy_tests/skips.txt

This file was deleted.

6 changes: 3 additions & 3 deletions run_tests_CLI/test_array_api.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash -e
python3 ivy_tests/write_array_api_tests_k_flag.py
python3 ivy_tests/array_api_testing/write_array_api_tests_k_flag.py
# shellcheck disable=SC2155
export ARRAY_API_TESTS_K_FLAG=$(cat ivy_tests/.array_api_tests_k_flag_$1)
export ARRAY_API_TESTS_K_FLAG=$(cat ivy_tests/array_api_testing/.array_api_tests_k_flag_$1)
if [ "$1" = "torch" ]; then
ARRAY_API_TESTS_K_FLAG="${ARRAY_API_TESTS_K_FLAG} and not (uint16 or uint32 or uint64)"
fi

mkdir -p .hypothesis
# shellcheck disable=SC2046
docker run --rm --env IVY_BACKEND="$1" --env ARRAY_API_TESTS_MODULE="ivy" --env REDIS_URL="$3" --env REDIS_PASSWD="$4" -v $(pwd):/ivy -v $(pwd)/.hypothesis:/.hypothesis unifyai/ivy:latest python3 -m pytest ivy_tests/test_array_api/array_api_tests/"$2".py -k "$ARRAY_API_TESTS_K_FLAG" --tb=short -vv
docker run --rm --env IVY_BACKEND="$1" --env ARRAY_API_TESTS_MODULE="ivy" --env REDIS_URL="$3" --env REDIS_PASSWD="$4" -v $(pwd):/ivy -v $(pwd)/.hypothesis:/.hypothesis unifyai/ivy:latest python3 -m pytest ivy_tests/array_api_testing/test_array_api/array_api_tests/"$2".py -k "$ARRAY_API_TESTS_K_FLAG" --tb=short -vv

0 comments on commit 72bcd06

Please sign in to comment.