Is there any alternative to creating one fixture per variable in a py.test class?
<p>I would like to use some common data in all my py.test class methods, and only in that class, e.g.</p>

<pre class="lang-py prettyprint-override"><code>n_files = 1000
n_classes = 10
n_file_per_class = int(n_files / n_classes)
</code></pre>

<p>I found out that I can use fixtures, e.g.:</p>

<pre class="lang-py prettyprint-override"><code>class TestDatasplit:

    @pytest.fixture()
    def n_files(self):
        return 1000

    @pytest.fixture()
    def n_classes(self):
        return 10

    @pytest.fixture()
    def n_files_per_class(self, n_files, n_classes):
        return int(n_files / n_classes)

    def test_datasplit_1(self, n_files):
        assert n_files == 1000

    def test_datasplit(self, n_files_per_class):
        assert n_files_per_class == 100
</code></pre>

<p>but here I need to create a fixture for all my variables, but that seems quite verbose (I have much more than 3 variables)...</p>

<p>What is the best way to create a bunch of shared variables in a py.test class?</p>