Skip to content

Commit 2cabd62

Browse files
committed
Turn BaseBackend into ABCMeta with NAME required property
1 parent a5050a2 commit 2cabd62

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

testinfra/backend/base.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# See the License for the specific language governing permissions and
1111
# limitations under the License.
1212

13+
import abc
1314
import collections
1415
import locale
1516
import logging
@@ -104,13 +105,18 @@ def __repr__(self):
104105
)
105106

106107

107-
class BaseBackend:
108+
class BaseBackend(metaclass=abc.ABCMeta):
108109
"""Represent the connection to the remote or local system"""
109110

110-
NAME = None
111111
HAS_RUN_SALT = False
112112
HAS_RUN_ANSIBLE = False
113113

114+
@property
115+
@classmethod
116+
@abc.abstractmethod
117+
def NAME(cls) -> str:
118+
raise NotImplementedError()
119+
114120
def __init__(self, hostname, sudo=False, sudo_user=None, *args, **kwargs):
115121
self._encoding = None
116122
self._host = None

0 commit comments

Comments
 (0)