Repository: readthedocs/readthedocs.org

Issue:
Remove all warnings from pytest
When running `tox` we see these warnings in the summary.

We should use `request` fixture and access to `request.config` instead.

Docs: https://docs.pytest.org/en/latest/fixture.html#request-context
Change log: https://docs.pytest.org/en/latest/deprecations.html#pytest-config-global


```
====================================================================================== warnings summary ======================================================================================
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_mkdocs
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_mkdocs_index
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_mkdocs_index_no_directory_urls
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_mkdocs_no_directory_urls
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_project_and_version
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_project_and_version_and_page
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_project_and_version_and_page_htmldir
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_project_and_version_and_page_signlehtml
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_project_and_version_htmldir
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_project_and_version_singlehtml
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_project_only
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_project_only_htmldir
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_project_only_singlehtml
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_restructured_text
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_restructured_text_invalid
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_translation_project_and_version
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_translation_project_and_version_and_page
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_translation_project_and_version_and_page_htmldir
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_translation_project_and_version_and_page_singlehtml
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_translation_project_and_version_htmldir
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_translation_project_and_version_singlehtml
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_translation_project_only
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_translation_project_only_htmldir
readthedocs/rtd_tests/tests/test_core_tags.py::CoreTagsTests::test_translation_project_only_singlehtml
  /home/humitos/rtfd/code/readthedocs-corporate/.tox/py36/readthedocs.org/readthedocs/rtd_tests/tests/test_core_tags.py:19: PytestDeprecationWarning: the `pytest.config` global is deprecated.  Please use `request.config` or `pytest_configure` (if you're a pytest plugin) instead.
    scheme=pytest.config.option.url_scheme,

-- Docs: https://docs.pytest.org/en/latest/warnings.html
```


Discussion:
How can I reproduce this warning summary?
Hi @rexzing.
You can use `tox` for running all the tests and to reproduce these warnings.
Docs: https://docs.readthedocs.io/en/latest/tests.html
Also, these warnings can be seen in travis, like in this case: https://travis-ci.org/rtfd/readthedocs.org/jobs/495002436
Got it. I am following these steps. Thanks
Hi guys,
I searched for a solution in past few days. But couldn't find out how to use `request.config` inside the `class CoreTagsTests(TestCase)`. 

Resolving patch:
diff --git a/conftest.py b/conftest.py
--- a/conftest.py
+++ b/conftest.py
@@ -47,6 +47,12 @@ def pytest_configure(config):
 def settings_modification(settings):
     settings.CELERY_ALWAYS_EAGER = True
 
+
 @pytest.fixture
 def api_client():
     return APIClient()
+
+
+@pytest.fixture(scope="class")
+def url_scheme(request):
+    request.cls.url_scheme = request.config.option.url_scheme


Test patch:
diff --git a/readthedocs/rtd_tests/tests/test_core_tags.py b/readthedocs/rtd_tests/tests/test_core_tags.py
--- a/readthedocs/rtd_tests/tests/test_core_tags.py
+++ b/readthedocs/rtd_tests/tests/test_core_tags.py
@@ -10,13 +10,14 @@
 from readthedocs.projects.models import Project
 
 
+@pytest.mark.usefixtures("url_scheme")
 @override_settings(USE_SUBDOMAIN=False, PRODUCTION_DOMAIN='readthedocs.org')
 class CoreTagsTests(TestCase):
     fixtures = ['eric', 'test_data']
 
     def setUp(self):
         url_base = '{scheme}://{domain}/docs/pip{{version}}'.format(
-            scheme=pytest.config.option.url_scheme,
+            scheme=self.url_scheme,
             domain=settings.PRODUCTION_DOMAIN,
         )