Namespace error with fixture (solved) I've set up a fixture, but Codeception can't find it. What am I missing or doing wrong?
% php vendor/bin/codecept run functional
...                                                                    
  [Error] Class 'myname\tests\fixtures\MyFixture' not found

In the sample code the namespaces are under myname but I've also tried using just tests\fixtures, tests\unit\fixtures, and myname\tests\unit\fixtures.
Thinking it's something to do with the namespace or most likely something to do with the Craft fixtures docs saying

Fixtures…can be defined in the fixturesMethod defined in the codeception.yml file.

My codeception.yml doesn't have fixturesMethod. I can imagine that's a way of doing some of this but haven't found any documentation describing what that configuration should look like.
I've also tried loading the fixture on the command line
% ./craft fixture/load ImageAssetFixture
Exception 'yii\base\InvalidConfigException' with message 'Invalid fixture namespace: &quot;tests\unit\fixtures&quot;. Please, check your FixtureController::namespace parameter'


% ./craft fixture/load ImageAssetFixture --namespace='myname\tests\fixtures'
Exception 'yii\base\InvalidConfigException' with message 'Invalid fixture namespace: &quot;myname\tests\fixtures&quot;. Please, check your FixtureController::namespace parameter'

Here's the setup:
tests/functional/AssetFixtureCest.php
&lt;?php

use FunctionalTester;
use myname\tests\fixtures\MyFixture;

class AssetFixtureCest
{
    public function _fixtures()
    {
        return [
            'myFixture' =&gt; [
                'class' =&gt; MyFixture::className(),
                'dataFile' =&gt; codecept_data_dir() . 'my-fixture.php',
            ],
        ];
    }

    public function testMyFixture(FunctionalTester $I)
    {
        $myFixture = $I-&gt;grabFixture('myFixture');
        codecept_debug($myFixture);
    }
}

tests/fixtures/MyFixture.php
&lt;?php

namespace myname\tests\fixtures;

use Craft;
use craft\test\fixtures\elements\...;

class MyFixture extends ...
{
    /**
     * {@inheritdoc}
     */
    public $dataFile = __DIR__ . '/data/my-fixture.php';
}

test/fixtures/data/my-fixture.php
&lt;?php

return [
    ...
];
I needed to define the namespace. In composer.json:
&quot;autoload&quot;: {
    &quot;psr-4&quot;: {
        &quot;myname\\tests\\fixtures&quot;: &quot;tests/fixtures&quot;
    }
}

and then
composer install

That uncovered some other problems with the above code (to anyone else who's trying to figure out fixtures, looking through the Craft repo's own tests directory is helpful), but that's separate from this question.