From 8e0d326f42d6ad22e590718631ac29654dbb0e96 Mon Sep 17 00:00:00 2001 From: Stas Bekman Date: Fri, 7 May 2021 12:58:42 -0700 Subject: [PATCH 1/4] restore conftest.py --- examples/{pytorch => }/conftest.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename examples/{pytorch => }/conftest.py (100%) diff --git a/examples/pytorch/conftest.py b/examples/conftest.py similarity index 100% rename from examples/pytorch/conftest.py rename to examples/conftest.py From c76e917a87e2fd6d06d9a2186a24cce4d0192222 Mon Sep 17 00:00:00 2001 From: Stas Bekman Date: Fri, 7 May 2021 14:01:47 -0700 Subject: [PATCH 2/4] fix conftest and make copies --- examples/legacy/conftest.py | 44 ++++++++++++++++++++++++++ examples/{ => pytorch}/conftest.py | 3 +- examples/research_projects/conftest.py | 44 ++++++++++++++++++++++++++ 3 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 examples/legacy/conftest.py rename examples/{ => pytorch}/conftest.py (95%) create mode 100644 examples/research_projects/conftest.py diff --git a/examples/legacy/conftest.py b/examples/legacy/conftest.py new file mode 100644 index 0000000000000..624233e68d9b3 --- /dev/null +++ b/examples/legacy/conftest.py @@ -0,0 +1,44 @@ +# Copyright 2020 The HuggingFace Team. All rights reserved. +# +# 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. + +# tests directory-specific settings - this file is run automatically +# by pytest before any tests are run + +import sys +import warnings +from os.path import abspath, dirname, join + + +# allow having multiple repository checkouts and not needing to remember to rerun +# 'pip install -e .[dev]' when switching between checkouts and running tests. +git_repo_path = abspath(join(dirname(dirname(dirname(__file__))), "src")) +sys.path.insert(1, git_repo_path) + +# silence FutureWarning warnings in tests since often we can't act on them until +# they become normal warnings - i.e. the tests still need to test the current functionality +warnings.simplefilter(action="ignore", category=FutureWarning) + + +def pytest_addoption(parser): + from transformers.testing_utils import pytest_addoption_shared + + pytest_addoption_shared(parser) + + +def pytest_terminal_summary(terminalreporter): + from transformers.testing_utils import pytest_terminal_summary_main + + make_reports = terminalreporter.config.getoption("--make-reports") + if make_reports: + pytest_terminal_summary_main(terminalreporter, id=make_reports) diff --git a/examples/conftest.py b/examples/pytorch/conftest.py similarity index 95% rename from examples/conftest.py rename to examples/pytorch/conftest.py index 2415ae8db1738..e85e5afb0200b 100644 --- a/examples/conftest.py +++ b/examples/pytorch/conftest.py @@ -22,9 +22,10 @@ # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switching between checkouts and running tests. -git_repo_path = abspath(join(dirname(dirname(__file__)), "src")) +git_repo_path = abspath(join(dirname(dirname(dirname(__file__))), "src")) sys.path.insert(1, git_repo_path) + # silence FutureWarning warnings in tests since often we can't act on them until # they become normal warnings - i.e. the tests still need to test the current functionality warnings.simplefilter(action="ignore", category=FutureWarning) diff --git a/examples/research_projects/conftest.py b/examples/research_projects/conftest.py new file mode 100644 index 0000000000000..624233e68d9b3 --- /dev/null +++ b/examples/research_projects/conftest.py @@ -0,0 +1,44 @@ +# Copyright 2020 The HuggingFace Team. All rights reserved. +# +# 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. + +# tests directory-specific settings - this file is run automatically +# by pytest before any tests are run + +import sys +import warnings +from os.path import abspath, dirname, join + + +# allow having multiple repository checkouts and not needing to remember to rerun +# 'pip install -e .[dev]' when switching between checkouts and running tests. +git_repo_path = abspath(join(dirname(dirname(dirname(__file__))), "src")) +sys.path.insert(1, git_repo_path) + +# silence FutureWarning warnings in tests since often we can't act on them until +# they become normal warnings - i.e. the tests still need to test the current functionality +warnings.simplefilter(action="ignore", category=FutureWarning) + + +def pytest_addoption(parser): + from transformers.testing_utils import pytest_addoption_shared + + pytest_addoption_shared(parser) + + +def pytest_terminal_summary(terminalreporter): + from transformers.testing_utils import pytest_terminal_summary_main + + make_reports = terminalreporter.config.getoption("--make-reports") + if make_reports: + pytest_terminal_summary_main(terminalreporter, id=make_reports) From 83ac061d9ff1c0dc90eaf8d3b4d5938087236e5c Mon Sep 17 00:00:00 2001 From: Stas Bekman Date: Fri, 7 May 2021 14:09:41 -0700 Subject: [PATCH 3/4] remove unneeded parts --- examples/legacy/conftest.py | 14 -------------- examples/research_projects/conftest.py | 14 -------------- 2 files changed, 28 deletions(-) diff --git a/examples/legacy/conftest.py b/examples/legacy/conftest.py index 624233e68d9b3..fc3a2e72353b8 100644 --- a/examples/legacy/conftest.py +++ b/examples/legacy/conftest.py @@ -28,17 +28,3 @@ # silence FutureWarning warnings in tests since often we can't act on them until # they become normal warnings - i.e. the tests still need to test the current functionality warnings.simplefilter(action="ignore", category=FutureWarning) - - -def pytest_addoption(parser): - from transformers.testing_utils import pytest_addoption_shared - - pytest_addoption_shared(parser) - - -def pytest_terminal_summary(terminalreporter): - from transformers.testing_utils import pytest_terminal_summary_main - - make_reports = terminalreporter.config.getoption("--make-reports") - if make_reports: - pytest_terminal_summary_main(terminalreporter, id=make_reports) diff --git a/examples/research_projects/conftest.py b/examples/research_projects/conftest.py index 624233e68d9b3..fc3a2e72353b8 100644 --- a/examples/research_projects/conftest.py +++ b/examples/research_projects/conftest.py @@ -28,17 +28,3 @@ # silence FutureWarning warnings in tests since often we can't act on them until # they become normal warnings - i.e. the tests still need to test the current functionality warnings.simplefilter(action="ignore", category=FutureWarning) - - -def pytest_addoption(parser): - from transformers.testing_utils import pytest_addoption_shared - - pytest_addoption_shared(parser) - - -def pytest_terminal_summary(terminalreporter): - from transformers.testing_utils import pytest_terminal_summary_main - - make_reports = terminalreporter.config.getoption("--make-reports") - if make_reports: - pytest_terminal_summary_main(terminalreporter, id=make_reports) From 149d821de32108957bf858b06dc8782e4e1b7434 Mon Sep 17 00:00:00 2001 From: Stas Bekman Date: Fri, 7 May 2021 14:24:11 -0700 Subject: [PATCH 4/4] remove unwanted files --- examples/legacy/conftest.py | 30 -------------------------- examples/research_projects/conftest.py | 30 -------------------------- 2 files changed, 60 deletions(-) delete mode 100644 examples/legacy/conftest.py delete mode 100644 examples/research_projects/conftest.py diff --git a/examples/legacy/conftest.py b/examples/legacy/conftest.py deleted file mode 100644 index fc3a2e72353b8..0000000000000 --- a/examples/legacy/conftest.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2020 The HuggingFace Team. All rights reserved. -# -# 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. - -# tests directory-specific settings - this file is run automatically -# by pytest before any tests are run - -import sys -import warnings -from os.path import abspath, dirname, join - - -# allow having multiple repository checkouts and not needing to remember to rerun -# 'pip install -e .[dev]' when switching between checkouts and running tests. -git_repo_path = abspath(join(dirname(dirname(dirname(__file__))), "src")) -sys.path.insert(1, git_repo_path) - -# silence FutureWarning warnings in tests since often we can't act on them until -# they become normal warnings - i.e. the tests still need to test the current functionality -warnings.simplefilter(action="ignore", category=FutureWarning) diff --git a/examples/research_projects/conftest.py b/examples/research_projects/conftest.py deleted file mode 100644 index fc3a2e72353b8..0000000000000 --- a/examples/research_projects/conftest.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2020 The HuggingFace Team. All rights reserved. -# -# 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. - -# tests directory-specific settings - this file is run automatically -# by pytest before any tests are run - -import sys -import warnings -from os.path import abspath, dirname, join - - -# allow having multiple repository checkouts and not needing to remember to rerun -# 'pip install -e .[dev]' when switching between checkouts and running tests. -git_repo_path = abspath(join(dirname(dirname(dirname(__file__))), "src")) -sys.path.insert(1, git_repo_path) - -# silence FutureWarning warnings in tests since often we can't act on them until -# they become normal warnings - i.e. the tests still need to test the current functionality -warnings.simplefilter(action="ignore", category=FutureWarning)