Closed Bug 1454514 Opened Last year Closed Last year
[mozversion] Convert tests to pytest format
59 bytes, text/x-review-board-request
See bug 1397417 for the tracking bug with motivations for this change.
Comment on attachment 8968355 [details] Bug 1454514 - [mozversion] Convert tests to pytest format; https://reviewboard.mozilla.org/r/237040/#review242998 Thanks, looks good! ::: testing/mozbase/mozversion/tests/test_binary.py:23 (Diff revision 1) > -class BinaryTest(unittest.TestCase): > - """test getting application version information from a binary path""" > +"""test getting application version information from a binary path""" > > - application_ini = """[App] > + > +@pytest.fixture(name='binary') > +def fixure_binary(tmpdir): nit: fixture (and two other places below) Out of curiosity, any reason you like to use `name` here? ::: testing/mozbase/mozversion/tests/test_binary.py:56 (Diff revision 1) > -SourceRepository = PlatformSourceRepo > -""" > +SourceRepository = PlatformSourceRepo""") > + return str(ini) > + > > - def setUp(self): > - self.cwd = os.getcwd() > +@pytest.mark.skipif( > + not os.environ.get('BROWSER_PATH'), Please use this fixture to find a binary: https://searchfox.org/mozilla-central/source/testing/mozbase/moztest/moztest/selftest/fixtures.py#97 Just importing `from moztest.selftest.fixtures import binary` should be good enough to use it (you'll need to flake8 ignore the import though). This fixture will use a local build if one was found, then it'll look for `GECKO_INSTALLER_URL` and automatically bootstrap it, finally it'll look for `GECKO_BINARY_PATH` and use that (this last part just landed and searchfox hasn't updated yet). Finally if no binary was found it'll return None, so you'll need to add a: if not binary: pytest.skip() If you like, you could create an autouse fixture that does: os.environ.setdefault('GECKO_BINARY_PATH', os.environ.get('BROWSER_PATH'))
Attachment #8968355 - Flags: review?(ahalberstadt) → review+
Comment on attachment 8968355 [details] Bug 1454514 - [mozversion] Convert tests to pytest format; https://reviewboard.mozilla.org/r/237040/#review242998 > nit: fixture (and two other places below) > > Out of curiosity, any reason you like to use `name` here? If the fixture name is taken from the function name, then a test that references the fixture without defining it as an argument will find the fixture function instead of the value returned by the fixture. Naming it this way means I'd get an error that `binary` is not defined rather than getting a reference to the function.
Pushed by email@example.com: https://hg.mozilla.org/integration/autoland/rev/2b620b4826e3 [mozversion] Convert tests to pytest format; r=ahal
You need to log in before you can comment on or make changes to this bug.