Bug 1417920 - squash pytest warnings about Test* classes; r=ted.mielczarek
☠☠ backed out by e9b4f255a116 ☠ ☠
authorNathan Froyd <froydnj@mozilla.com>
Fri, 01 Jun 2018 15:39:54 -0400
changeset 421587 2491b63fe79aa6113a77c49f2fa9f7c2ed7e59ff
parent 421586 3c32805d476c68e3caca8d2be1c537c027f01224
child 421588 5fd3144d5d009fdac3fae2ee33143901164e0d12
push id104070
push usernfroyd@mozilla.com
push dateWed, 06 Jun 2018 15:08:37 +0000
treeherdermozilla-inbound@5fd3144d5d00 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1417920 - squash pytest warnings about Test* classes; r=ted.mielczarek Having an imported class that begins with `Test` causes pytest to warn: =================================== warnings summary ==================================== mozbuild/test/backend/test_recursivemake.py::TestMetadataBackend cannot collect test class 'TestMetadataBackend' because it has a __init__ constructor -- Docs: http://doc.pytest.org/en/latest/warnings.html After seeing this several times and each time wondering what the yellow output in your terminal might mean, the warning starts to get tiresome. A class-scope `__test__` attribute set to `False` makes this warning go away; let's do that and eliminate this papercut.
--- a/python/mozbuild/mozbuild/backend/test_manifest.py
+++ b/python/mozbuild/mozbuild/backend/test_manifest.py
@@ -11,16 +11,18 @@ import mozpack.path as mozpath
 from mozbuild.backend.base import PartialBackend
 from mozbuild.frontend.data import TestManifest
 class TestManifestBackend(PartialBackend):
     """Partial backend that generates test metadata files."""
+    __test__ = False
     def _init(self):
         self.tests_by_path = defaultdict(list)
         self.installs_by_path = defaultdict(list)
         self.deferred_installs = set()
         self.manifest_defaults = {}
         # Add config.status so performing a build will invalidate this backend.
--- a/python/mozbuild/mozbuild/test/backend/test_test_manifest.py
+++ b/python/mozbuild/mozbuild/test/backend/test_test_manifest.py
@@ -11,16 +11,18 @@ import mozpack.path as mozpath
 from mozunit import main
 from mozbuild.backend.test_manifest import TestManifestBackend
 from mozbuild.test.backend.common import BackendTester
 class TestTestManifestBackend(BackendTester):
+    __test__ = False
     def test_all_tests_metadata_file_written(self):
         """Ensure all-tests.pkl is generated."""
         env = self._consume('test-manifests-written', TestManifestBackend)
         all_tests_path = mozpath.join(env.topobjdir, 'all-tests.pkl')
         with open(all_tests_path, 'rb') as fh: