Move benchmarks into the test directory (#10614)

This commit is contained in:
Carlos Mocholí 2021-11-19 03:07:33 +01:00 committed by GitHub
parent 0de8ab4f2e
commit 5788789f01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 6 additions and 28 deletions

View File

@ -36,7 +36,7 @@ jobs:
steps:
- bash: |
python -m pytest benchmarks -v --durations=0
python -m pytest tests/benchmarks -v --durations=0
displayName: 'Testing: benchmarks'
env:
PL_RUNNING_BENCHMARKS: 1

View File

@ -68,7 +68,7 @@ jobs:
displayName: 'Get legacy checkpoints'
- bash: |
python -m coverage run --source pytorch_lightning -m pytest pytorch_lightning tests -v --junitxml=$(Build.StagingDirectory)/test-results.xml --durations=50
python -m coverage run --source pytorch_lightning -m pytest pytorch_lightning tests --ignore tests/benchmarks -v --junitxml=$(Build.StagingDirectory)/test-results.xml --durations=50
displayName: 'Testing: standard'
- bash: |
@ -113,5 +113,5 @@ jobs:
displayName: 'Testing: examples'
- bash: |
python -m pytest benchmarks -v --maxfail=2 --durations=0
python -m pytest tests/benchmarks -v --maxfail=2 --durations=0
displayName: 'Testing: benchmarks'

View File

@ -1,18 +0,0 @@
# Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
_BENCHMARK_ROOT = os.path.dirname(__file__)
_PROJECT_ROOT = os.path.dirname(_BENCHMARK_ROOT)
_PATH_DATASETS = os.path.join(_PROJECT_ROOT, "Datasets")

View File

@ -7,7 +7,6 @@ requires = [
[tool.isort]
known_first_party = [
"benchmarks",
"docs",
"pl_examples",
"pytorch_lightning",
@ -24,7 +23,7 @@ line-length = 120
[tool.mypy]
files = ["pytorch_lightning", "pl_examples", "benchmarks"]
files = ["pytorch_lightning"]
disallow_untyped_defs = "True"
ignore_missing_imports = "True"
show_error_codes = "True"
@ -53,9 +52,6 @@ module = [
"pytorch_lightning.distributed.*",
"pytorch_lightning.tuner.*",
"pytorch_lightning.utilities.*",
"pl_examples.*",
"benchmarks.*",
"tests.helpers.*"
]
ignore_errors = "True"

View File

View File

@ -16,7 +16,7 @@ import os
import matplotlib.pylab as plt
import pandas as pd
from benchmarks.test_basic_parity import measure_loops
from tests.benchmarks.test_basic_parity import measure_loops
from tests.helpers.advanced_models import ParityModuleMNIST, ParityModuleRNN
NUM_EPOCHS = 20

View File

@ -20,7 +20,7 @@ export PL_RUNNING_SPECIAL_TESTS=1
defaults='-m coverage run --source pytorch_lightning --append -m pytest --capture=no'
# find tests marked as `@RunIf(special=True)`. done manually instead of with pytest because it is faster
grep_output=$(grep --recursive --word-regexp 'tests' 'benchmarks' --regexp 'special=True' --include '*.py' --exclude 'tests/conftest.py')
grep_output=$(grep --recursive --word-regexp 'tests' --regexp 'special=True' --include '*.py' --exclude 'tests/conftest.py')
# file paths, remove duplicates
files=$(echo "$grep_output" | cut -f1 -d: | sort | uniq)