Skip to content

Commit b11be78

Browse files
committed
Rename tests
For legacy reasons (during the time from tensorflow v1 => v2), we splits tests into two groups: - tests/test_xxx.py which is used in v1 mode (and `tf.compat.v1.disable_eager_execution()` called) - tests/test_xxx_eager.py which is used in v2 mode. The reason was to prevent the mixture of v1 and v2 mode as tensorflow may crash when two modes are mixed. Over time it seems these two modes are not exactly follows. For example, tests/test_azure.py is running in v2 mode though they are groups in v1 during tests. This PR changes the name so that: - tests/test_xxx.py will always be run in v2 mode. - tests/test_xxx_v1.py will always be run in v1 mode (and `tf.compat.v1.disable_eager_execution()` called) Signed-off-by: Yong Tang <[email protected]>
1 parent c5e8e87 commit b11be78

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1168
-1313
lines changed

.github/workflows/build.wheel.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ run_test() {
77
CPYTHON_VERSION=$($entry -c 'import sys; print(str(sys.version_info[0])+str(sys.version_info[1]))')
88
(cd wheelhouse && $entry -m pip install tensorflow_io-*-cp${CPYTHON_VERSION}-*.whl)
99
$entry -m pip install -q pytest pytest-benchmark boto3 fastavro avro-python3 scikit-image pandas pyarrow==3.0.0 google-cloud-pubsub==2.1.0 google-cloud-bigtable==1.6.0 google-cloud-bigquery-storage==1.1.0 google-cloud-bigquery==2.3.1 google-cloud-storage==1.32.0
10-
(cd tests && $entry -m pytest --benchmark-disable -v --import-mode=append $(find . -type f \( -iname "test_*.py" ! \( -iname "test_*_eager.py" \) \)))
11-
(cd tests && $entry -m pytest --benchmark-disable -v --import-mode=append $(find . -type f \( -iname "test_*_eager.py" ! \( -iname "test_bigquery_eager.py" \) \)))
10+
(cd tests && $entry -m pytest --benchmark-disable -v --import-mode=append $(find . -type f \( -iname "test_*_v1.py" \)))
11+
(cd tests && $entry -m pytest --benchmark-disable -v --import-mode=append $(find . -type f \( -iname "test_*.py" ! \( -iname "test_*_v1.py" -o -iname "test_bigquery.py" \) \)))
1212
# GRPC and test_bigquery_eager tests have to be executed separately because of https://github.com/grpc/grpc/issues/20034
13-
(cd tests && $entry -m pytest --benchmark-disable -v --import-mode=append $(find . -type f \( -iname "test_bigquery_eager.py" \)))
13+
(cd tests && $entry -m pytest --benchmark-disable -v --import-mode=append $(find . -type f \( -iname "test_bigquery.py" \)))
1414
}
1515

1616
PYTHON_VERSION=python

.github/workflows/build.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -434,14 +434,13 @@ jobs:
434434
python --version
435435
python -m pip install -U pytest-benchmark
436436
rm -rf tensorflow_io
437-
(cd tests && python -m pytest -s -v test_lmdb_eager.py)
438-
(python -m pytest -s -v test_image_eager.py -k "webp or ppm or bmp or bounding or exif or hdr or openexr or tiff or avif")
439-
(python -m pytest -s -v test_serialization_eager.py)
440-
(python -m pytest -s -v test_io_dataset_eager.py -k "numpy or hdf5 or audio or to_file")
441-
(python -m pytest -s -v test_http_eager.py)
437+
(cd tests && python -m pytest -s -v test_lmdb.py)
438+
(python -m pytest -s -v test_image.py -k "webp or ppm or bmp or bounding or exif or hdr or openexr or tiff or avif")
439+
(python -m pytest -s -v test_serialization.py)
440+
(python -m pytest -s -v test_io_dataset.py -k "numpy or hdf5 or audio or to_file")
441+
(python -m pytest -s -v test_http.py)
442442
python -m pip install google-cloud-bigquery-storage==0.7.0 google-cloud-bigquery==1.22.0 fastavro
443-
(python -m pytest -s -v test_bigquery_eager.py)
444-
(python -m pytest -s -v test_dicom_eager.py)
443+
(python -m pytest -s -v test_bigquery.py)
445444
(python -m pytest -s -v test_dicom.py)
446445
447446
release:

docs/development.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ bazel build -s --verbose_failures $BAZEL_OPTIMIZATION //tensorflow_io/...
8888
# `bazel-bin/tensorflow_io/core/python/ops/` and it is possible
8989
# to run tests with `pytest`, e.g.:
9090
sudo python3 -m pip install pytest
91-
TFIO_DATAPATH=bazel-bin python3 -m pytest -s -v tests/test_serialization_eager.py
91+
TFIO_DATAPATH=bazel-bin python3 -m pytest -s -v tests/test_serialization.py
9292
```
9393

9494
NOTE: When running pytest, `TFIO_DATAPATH=bazel-bin` has to be passed so that python can utilize the generated shared libraries after the build process.
@@ -147,7 +147,7 @@ bazel build -s --verbose_failures $BAZEL_OPTIMIZATION //tensorflow_io/...
147147
# `bazel-bin/tensorflow_io/core/python/ops/` and it is possible
148148
# to run tests with `pytest`, e.g.:
149149
sudo python3 -m pip install pytest
150-
TFIO_DATAPATH=bazel-bin python3 -m pytest -s -v tests/test_serialization_eager.py
150+
TFIO_DATAPATH=bazel-bin python3 -m pytest -s -v tests/test_serialization.py
151151
```
152152

153153
##### CentOS 8
@@ -207,7 +207,7 @@ scl enable rh-python36 devtoolset-9 \
207207

208208
TFIO_DATAPATH=bazel-bin \
209209
scl enable rh-python36 devtoolset-9 \
210-
'python3 -m pytest -s -v tests/test_serialization_eager.py'
210+
'python3 -m pytest -s -v tests/test_serialization.py'
211211
```
212212

213213
#### Python Wheels
@@ -295,7 +295,7 @@ use:
295295
$ bash -x -e tests/test_kafka/kafka_test.sh
296296

297297
# Run the tests
298-
$ TFIO_DATAPATH=bazel-bin pytest -s -vv tests/test_kafka_eager.py
298+
$ TFIO_DATAPATH=bazel-bin pytest -s -vv tests/test_kafka.py
299299
```
300300

301301
Testing `Datasets` associated with tools such as `Elasticsearch` or `MongoDB`
@@ -307,7 +307,7 @@ require docker to be available on the system. In such scenarios, use:
307307
$ bash tests/test_elasticsearch/elasticsearch_test.sh start
308308

309309
# Run the tests
310-
$ TFIO_DATAPATH=bazel-bin pytest -s -vv tests/test_elasticsearch_eager.py
310+
$ TFIO_DATAPATH=bazel-bin pytest -s -vv tests/test_elasticsearch.py
311311

312312
# Stop and remove the container
313313
$ bash tests/test_elasticsearch/elasticsearch_test.sh stop
@@ -319,7 +319,7 @@ For example, to run tests related to `parquet` dataset's, use:
319319

320320
```sh
321321
# Just run the test
322-
$ TFIO_DATAPATH=bazel-bin pytest -s -vv tests/test_parquet_eager.py
322+
$ TFIO_DATAPATH=bazel-bin pytest -s -vv tests/test_parquet.py
323323
```
324324

325325

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)