Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using templates with incorrect order #87

Open
pgundlach opened this issue Jan 25, 2021 · 1 comment
Open

Error when using templates with incorrect order #87

pgundlach opened this issue Jan 25, 2021 · 1 comment

Comments

@pgundlach
Copy link

I like test fixtures but encountered a minor (documentation) problem:

When I use this:

...
testfixtures.Database(db.DB()),
testfixtures.Dialect("sqlite"),
testfixtures.Directory("testdata/fixtures"),
testfixtures.Template(),
testfixtures.TemplateFuncs(template.FuncMap{
	"now": now,
}),

I get an error:

testfixtures: could not unmarshal YAML: yaml: invalid map key: map[interface {}]interface {}{"now":interface {}(nil)}

When I move the line with Directory() down a bit, everything works fine:

testfixtures.Database(db.DB()),
testfixtures.Dialect("sqlite"),
testfixtures.Template(),
testfixtures.TemplateFuncs(template.FuncMap{
	"now": now,
}),
testfixtures.Directory("testdata/fixtures"),

I could not see this in the documentation. It might be worth mentioning?

@andreynering
Copy link
Contributor

Hi @pgundlach,

Yes, Directory, Files and Paths should always be the last option in the call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants