hovel / pybbm

Django forum solution. Tested, documented, shipped with example project.
BSD 2-Clause "Simplified" License
225 stars 151 forks source link

Allow ALL tests to be runned with all DB #258

Closed DylannCordel closed 7 years ago

DylannCordel commented 7 years ago

With a DB (like MySQL) which does not support microseconds, we force a 1 second sleep for some operations to avoid failures for some tests which require a different datetime between two operations.
It adds few seconds to run the test suite with mysql but it run all tests (there were some tests which were skipped for mysql)

This commit allow to run test with sqlite, mysql or postgres with tox for local testing.

Also fix travis issues:

Add methods create_post and create_post_via_http in tests.py to simplify tests creation.

Add a "problems" section in the doc about using DBs without microseconds support to explain what are the side-effects.

DylannCordel commented 7 years ago

Travis is 1% slower with this PR. If Travis's running time is really important, I think we have many ways to improve tests performances.

skolsuper commented 7 years ago

@DylannCordel PR: #191 is relevant. Sorry, that's probably pretty important background information that you could have had sooner. Anyway your fix looks okay to me and I'm sure nobody is going to lose sleep over an extra 1% running time on Travis.

FYI I am no longer working with pybb (or even Python 😭) so don't get much time to contribute on this any more. That probably means I should close my open PRs as I likely won't update them (I don't even agree with some of them now), but I will leave them there a little longer in case someone finds them useful somehow.

DylannCordel commented 7 years ago

@skolsuper Thx for your feedback. I didn't see #191. Tests were 15min slower with old sleeps (unconditional). Tests are now 1 min slower but code is fully tested with MySQL (same running time for local testing with Postgres or SQLite). IMHO, full testing is more important than test time saving.

To shame you 're not working anymore with python :crying_cat_face:. I'm sorry for you. Thanks for your invitation to contribute on your pybbm's PR. I'll rebase your code to keep these PR mergeable by @lampslave I hope you'll be back as python dev asap :wink:

lampslave commented 7 years ago

MySQL 5.7 supports microseconds, but Travis CI does not support MySQL 5.7 :( Anyway, shortcuts are always good idea, thank you :)