from __future__ import absolute_import, unicode_literals

import unittest

from mopidy import config, ext


class ExtensionTest(unittest.TestCase):

    def setUp(self):  # noqa: N802
        self.ext = ext.Extension()

    def test_dist_name_is_none(self):
        self.assertIsNone(self.ext.dist_name)

    def test_ext_name_is_none(self):
        self.assertIsNone(self.ext.ext_name)

    def test_version_is_none(self):
        self.assertIsNone(self.ext.version)

    def test_get_default_config_raises_not_implemented(self):
        with self.assertRaises(NotImplementedError):
            self.ext.get_default_config()

    def test_get_config_schema_returns_extension_schema(self):
        schema = self.ext.get_config_schema()
        self.assertIsInstance(schema['enabled'], config.Boolean)

    def test_validate_environment_does_nothing_by_default(self):
        self.assertIsNone(self.ext.validate_environment())

    def test_setup_raises_not_implemented(self):
        with self.assertRaises(NotImplementedError):
            self.ext.setup(None)

from __future__ import absolute_import, unicode_literals

import pytest

from mopidy import config, ext


@pytest.fixture
def extension():
    return ext.Extension()


def test_dist_name_is_none(extension):
    assert extension.dist_name is None


def test_ext_name_is_none(extension):
    assert extension.ext_name is None


def test_version_is_none(extension):
    assert extension.version is None


def test_get_default_config_raises_not_implemented(extension):
    with pytest.raises(NotImplementedError):
        extension.get_default_config()


def test_get_config_schema_returns_extension_schema(extension):
    schema = extension.get_config_schema()
    assert isinstance(schema['enabled'], config.Boolean)


def test_validate_environment_does_nothing_by_default(extension):
    assert extension.validate_environment() is None


def test_setup_raises_not_implemented(extension):
    with pytest.raises(NotImplementedError):
        extension.setup(None)

Convert ext test to pytests
tests: Convert ext test to pytests

  from __future__ import absolute_import, unicode_literals
  
- import unittest
+ import pytest
  
  from mopidy import config, ext
  
  
- class ExtensionTest(unittest.TestCase):
+ @pytest.fixture
+ def extension():
+     return ext.Extension()
  
-     def setUp(self):  # noqa: N802
-         self.ext = ext.Extension()
  
-     def test_dist_name_is_none(self):
+ def test_dist_name_is_none(extension):
-         self.assertIsNone(self.ext.dist_name)
+     assert extension.dist_name is None
  
-     def test_ext_name_is_none(self):
-         self.assertIsNone(self.ext.ext_name)
  
-     def test_version_is_none(self):
-         self.assertIsNone(self.ext.version)
+ def test_ext_name_is_none(extension):
+     assert extension.ext_name is None
  
-     def test_get_default_config_raises_not_implemented(self):
-         with self.assertRaises(NotImplementedError):
-             self.ext.get_default_config()
  
+ def test_version_is_none(extension):
+     assert extension.version is None
-     def test_get_config_schema_returns_extension_schema(self):
-         schema = self.ext.get_config_schema()
-         self.assertIsInstance(schema['enabled'], config.Boolean)
  
-     def test_validate_environment_does_nothing_by_default(self):
-         self.assertIsNone(self.ext.validate_environment())
  
-     def test_setup_raises_not_implemented(self):
+ def test_get_default_config_raises_not_implemented(extension):
-         with self.assertRaises(NotImplementedError):
+     with pytest.raises(NotImplementedError):
-             self.ext.setup(None)
+         extension.get_default_config()
  
+ 
+ def test_get_config_schema_returns_extension_schema(extension):
+     schema = extension.get_config_schema()
+     assert isinstance(schema['enabled'], config.Boolean)
+ 
+ 
+ def test_validate_environment_does_nothing_by_default(extension):
+     assert extension.validate_environment() is None
+ 
+ 
+ def test_setup_raises_not_implemented(extension):
+     with pytest.raises(NotImplementedError):
+         extension.setup(None)
+ 
Convert ext test to pytests
## Code Before:
from __future__ import absolute_import, unicode_literals

import unittest

from mopidy import config, ext


class ExtensionTest(unittest.TestCase):

    def setUp(self):  # noqa: N802
        self.ext = ext.Extension()

    def test_dist_name_is_none(self):
        self.assertIsNone(self.ext.dist_name)

    def test_ext_name_is_none(self):
        self.assertIsNone(self.ext.ext_name)

    def test_version_is_none(self):
        self.assertIsNone(self.ext.version)

    def test_get_default_config_raises_not_implemented(self):
        with self.assertRaises(NotImplementedError):
            self.ext.get_default_config()

    def test_get_config_schema_returns_extension_schema(self):
        schema = self.ext.get_config_schema()
        self.assertIsInstance(schema['enabled'], config.Boolean)

    def test_validate_environment_does_nothing_by_default(self):
        self.assertIsNone(self.ext.validate_environment())

    def test_setup_raises_not_implemented(self):
        with self.assertRaises(NotImplementedError):
            self.ext.setup(None)

## Instruction:
Convert ext test to pytests
## Code After:
from __future__ import absolute_import, unicode_literals

import pytest

from mopidy import config, ext


@pytest.fixture
def extension():
    return ext.Extension()


def test_dist_name_is_none(extension):
    assert extension.dist_name is None


def test_ext_name_is_none(extension):
    assert extension.ext_name is None


def test_version_is_none(extension):
    assert extension.version is None


def test_get_default_config_raises_not_implemented(extension):
    with pytest.raises(NotImplementedError):
        extension.get_default_config()


def test_get_config_schema_returns_extension_schema(extension):
    schema = extension.get_config_schema()
    assert isinstance(schema['enabled'], config.Boolean)


def test_validate_environment_does_nothing_by_default(extension):
    assert extension.validate_environment() is None


def test_setup_raises_not_implemented(extension):
    with pytest.raises(NotImplementedError):
        extension.setup(None)
