Repository: microsoft/Qcodes

Issue:
Group parameter does not have label , description and unit  (and possibly other) kwargs
Currently, because the group parameter inherits from `_BaseParameter`, it does not have often used keyword arguments. 


Discussion:
Branch for this issue: https://github.com/sohailc/Qcodes/tree/bug/add_kwargs_to_group_param

Resolving patch:
diff --git a/qcodes/instrument/group_parameter.py b/qcodes/instrument/group_parameter.py
--- a/qcodes/instrument/group_parameter.py
+++ b/qcodes/instrument/group_parameter.py
@@ -1,11 +1,11 @@
 from collections import OrderedDict
-from typing import List, Union, Callable, Dict, Any
+from typing import List, Union, Callable, Dict, Any, Optional
 
-from qcodes.instrument.parameter import _BaseParameter
+from qcodes.instrument.parameter import Parameter
 from qcodes import Instrument
 
 
-class GroupParameter(_BaseParameter):
+class GroupParameter(Parameter):
     """
     Group parameter is a `Parameter` which value can be set or gotten only
     together with other group parameters. This happens when an instrument
@@ -27,9 +27,21 @@ class GroupParameter(_BaseParameter):
         instrument
             instrument that this parameter belongs to; this instrument is
             used by the group to call its get and set commands
+
+        **kwargs:
+            All kwargs used by the Parameter class, except set_cmd and get_cmd
     """
 
-    def __init__(self, name: str, instrument: Instrument, **kwargs) -> None:
+    def __init__(
+            self, name: str,
+            instrument: Optional['Instrument'] = None,
+            **kwargs
+    ) -> None:
+
+        if "set_cmd" in kwargs or "get_cmd" in kwargs:
+            raise ValueError("A GroupParameter does not use 'set_cmd' or "
+                             "'get_cmd' kwarg")
+
         self.group: Union[Group, None] = None
         super().__init__(name, instrument=instrument, **kwargs)
 


Test patch:
diff --git a/qcodes/tests/test_group_parameter.py b/qcodes/tests/test_group_parameter.py
--- a/qcodes/tests/test_group_parameter.py
+++ b/qcodes/tests/test_group_parameter.py
@@ -1,4 +1,5 @@
 import re
+import pytest
 
 from qcodes.instrument.group_parameter import GroupParameter, Group
 from qcodes import Instrument
@@ -14,13 +15,19 @@ def __init__(self, name: str) -> None:
         self.add_parameter(
             "a",
             get_parser=int,
-            parameter_class=GroupParameter
+            parameter_class=GroupParameter,
+            docstring="Some succinct description",
+            label="label",
+            unit="SI"
         )
 
         self.add_parameter(
             "b",
             get_parser=int,
-            parameter_class=GroupParameter
+            parameter_class=GroupParameter,
+            docstring="Some succinct description",
+            label="label",
+            unit="SI"
         )
 
         Group(
@@ -58,3 +65,15 @@ def test_sanity():
     dummy.b(10)
     assert dummy.a() == 3
     assert dummy.b() == 10
+
+
+def test_raise_on_get_set_cmd():
+
+    for arg in ["set_cmd", "get_cmd"]:
+        kwarg = {arg: ""}
+
+        with pytest.raises(ValueError) as e:
+            GroupParameter(name="a", **kwarg)
+
+        assert str(e.value) == "A GroupParameter does not use 'set_cmd' or " \
+                               "'get_cmd' kwarg"