diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md
index cfdfee22ab3..dce3788a2cd 100644
--- a/doc/releases/changelog-dev.md
+++ b/doc/releases/changelog-dev.md
@@ -9,6 +9,9 @@
Improvements ðŸ›
+* Add support for 3 new pytest markers: `unit`, `integration` and `system`.
+ [(#5517)](https://github.com/PennyLaneAI/pennylane/pull/5517)
+
* The sorting order of parameter-shift terms is now guaranteed to resolve ties in the absolute value with the sign of the shifts.
[(#5582)](https://github.com/PennyLaneAI/pennylane/pull/5582)
@@ -175,5 +178,6 @@ Soran Jahangiri,
Korbinian Kottmann,
Christina Lee,
Vincent Michaud-Rioux,
+Lee James O'Riordan,
Kenya Sakka,
David Wierichs.
diff --git a/tests/numpy/test_numpy_random.py b/tests/numpy/test_numpy_random.py
index d8db4ff0e27..6cfd9e483a6 100644
--- a/tests/numpy/test_numpy_random.py
+++ b/tests/numpy/test_numpy_random.py
@@ -43,6 +43,7 @@
general_gen = random.default_rng()
+@pytest.mark.unit
class TestGeneratorDistributions:
@pytest.mark.parametrize("distribution", distributions_no_extra_input)
def test_generator_distributions(self, distribution):
@@ -61,6 +62,7 @@ def test_generator_distributions(self, distribution):
assert output.requires_grad is False
+@pytest.mark.unit
class Test_default_rng:
def test_no_input(self):
"""Tests that np.random.default_rng() returns a generator object when
diff --git a/tests/numpy/test_numpy_wrapper.py b/tests/numpy/test_numpy_wrapper.py
index 0c28828e858..f89bc715b6e 100644
--- a/tests/numpy/test_numpy_wrapper.py
+++ b/tests/numpy/test_numpy_wrapper.py
@@ -25,6 +25,7 @@
from pennylane.numpy.tensor import tensor_to_arraybox
+@pytest.mark.unit
class TestExtractTensors:
"""Tests for the extract_tensors function"""
@@ -56,6 +57,7 @@ def test_iterable_with_unpatched_numpy_arrays(self):
assert res[1] is arr2
+@pytest.mark.unit
class TestTensor:
"""Tests for the Tensor(ndarray) subclass"""
@@ -141,6 +143,7 @@ def test_numpy_to_arraybox(self):
]
+@pytest.mark.unit
class TestNumpyIntegration:
"""Test that the wrapped NumPy functionality integrates well
with standard NumPy functions."""
@@ -428,6 +431,7 @@ def __call__(self, *args, **kwargs):
assert len(res) == 2
+@pytest.mark.integration
class TestAutogradIntegration:
"""Test autograd works with the new tensor subclass"""
@@ -458,6 +462,7 @@ def cost(x):
grad_fn(arr1)
+@pytest.mark.unit
class TestScalarHashing:
"""Test for the hashing capability of scalar arrays."""
@@ -505,6 +510,7 @@ def test_nonzero_dim_arrays_non_hashable(self):
class TestNumpyConversion:
"""Tests for the tensor.unwrap() and tensor.numpy() methods"""
+ @pytest.mark.unit
def test_convert_scalar_array(self):
"""Test that a scalar array converts to a python literal"""
data = np.array(1.543)
@@ -512,6 +518,7 @@ def test_convert_scalar_array(self):
assert res == data.item()
assert isinstance(res, float)
+ @pytest.mark.unit
def test_convert_array(self):
"""Test that a numpy array successfully converts"""
data = np.array([1, 2, 3])
@@ -522,6 +529,7 @@ def test_convert_array(self):
assert isinstance(res, np.ndarray)
assert not isinstance(res, np.tensor)
+ @pytest.mark.system
def test_single_gate_parameter(self):
"""Test that when supplied a PennyLane tensor, a QNode passes an
unwrapped tensor as the argument to a gate taking a single parameter"""
@@ -545,6 +553,7 @@ def circuit(phi=None):
assert op.name == "RX"
assert op.parameters == [p]
+ @pytest.mark.system
def test_multiple_gate_parameter(self):
"""Test that when supplied a PennyLane tensor, a QNode passes arguments
as unwrapped tensors to a gate taking multiple parameters"""
diff --git a/tests/pytest.ini b/tests/pytest.ini
index 85bd26efbd6..4c2812d4a75 100644
--- a/tests/pytest.ini
+++ b/tests/pytest.ini
@@ -1,5 +1,8 @@
[pytest]
markers =
+ unit: marks tests as unit-level tests (select with '-m "unit"')
+ integration: marks tests as integration-level tests (select with '-m "integration"')
+ system: marks tests as system-level tests (select with '-m "system"')
core: marks tests for core testing (select with '-m "core"')
autograd: marks tests for autograd testing (select with '-m "autograd"')
torch: marks tests for torch testing (select with '-m "core"')