spanezz / staticsite

Static site generator
GNU General Public License v3.0
46 stars 7 forks source link

Settings is singleton? #8

Closed TobiX closed 7 years ago

TobiX commented 7 years ago

Currently, settings in staticsite/core.py is a singleton, which makes unittest using different configuration a bit awkward. I have a simple workaround in my branch, so this is a minor issue.

spanezz commented 7 years ago

For the settings singleton I followed what Django does, maybe we can follow what Django does also for settings. Would you like something like override_settings also in staticsite?

TobiX commented 7 years ago

Well, I wanted to test the behaviour with multiple different settings files, so I came up with this ugly hack: https://github.com/TobiX/staticsite/commit/d790097fed0b693715c999328418d932fec8c6dd#diff-423890b7e3c2aa4791f9e203b7f194cbR24 - If the settings were a member of, for example SiteCommand, this wouldn't be a problem, since I could construct new objects for each test.

spanezz commented 7 years ago

I'll have a look if I can make settings part of Site

spanezz commented 7 years ago

Should be done in 9d34a95cf5432c2b30e1a5a973704df2302f9be0