Discussion:
[Trac-dev] simplemultiproject
Jeffrey Ratcliffe
2016-11-11 20:59:27 UTC
Permalink
I'm writing a plugin that adds to the functionality in the
simplemultiproject plugin and I'm struggling to run the tests in smp.

python setup.py test

and similar don't find any tests.

python -m unittest discover

finds them, but produces a load of errors about the smp tables not existing.

How do I run the unit tests in smp?

Regards

Jeff
--
You received this message because you are subscribed to the Google Groups "Trac Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-dev+***@googlegroups.com.
To post to this group, send email to trac-***@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-dev.
For more options, visit https://groups.google.com/d/optout.
RjOllos
2016-11-11 21:39:34 UTC
Permalink
Post by Jeffrey Ratcliffe
I'm writing a plugin that adds to the functionality in the
simplemultiproject plugin and I'm struggling to run the tests in smp.
python setup.py test
It should work after [15952]

https://trac-hacks.org/changeset/15952

However, many tests are failing. It looks like the environment upgrade
isn't properly implemented in setUp.
Post by Jeffrey Ratcliffe
and similar don't find any tests.
python -m unittest discover
finds them, but produces a load of errors about the smp tables not existing.
How do I run the unit tests in smp?
Regards
Jeff
--
You received this message because you are subscribed to the Google Groups "Trac Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-dev+***@googlegroups.com.
To post to this group, send email to trac-***@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-dev.
For more options, visit https://groups.google.com/d/optout.
Jeffrey Ratcliffe
2016-11-14 19:34:37 UTC
Permalink
Post by RjOllos
It should work after [15952]
https://trac-hacks.org/changeset/15952
Certainly the tests are now found correctly. Thanks.
Post by RjOllos
However, many tests are failing. It looks like the environment upgrade
isn't properly implemented in setUp.
I've been doing some hacking around, and the EnvironmentStub class in trac
does not seem to deal well with an environment upgrade.

In trac/env.py, the database manager shuts down all connections after an
upgrade. The sqlite db for tests is in memory, is it not? Perhaps shutting
it down also kills the db, and when the connection is reopened, it is empty?

If I comment out the DatabaseManager(self).
shutdown() line, the results of the upgrade are there.

So to me, this looks like a bug in trac.
--
You received this message because you are subscribed to the Google Groups "Trac Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-dev+***@googlegroups.com.
To post to this group, send email to trac-***@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-dev.
For more options, visit https://groups.google.com/d/optout.
RjOllos
2016-11-15 06:48:29 UTC
Permalink
Post by Jeffrey Ratcliffe
Post by RjOllos
It should work after [15952]
https://trac-hacks.org/changeset/15952
Certainly the tests are now found correctly. Thanks.
Tests are passing with in-memory SQLite database after r15965.
https://trac-hacks.org/changeset/15965
I haven't tested with other databases.
Post by Jeffrey Ratcliffe
However, many tests are failing. It looks like the environment upgrade
Post by RjOllos
isn't properly implemented in setUp.
I've been doing some hacking around, and the EnvironmentStub class in trac
does not seem to deal well with an environment upgrade.
In trac/env.py, the database manager shuts down all connections after an
upgrade. The sqlite db for tests is in memory, is it not? Perhaps shutting
it down also kills the db, and when the connection is reopened, it is empty?
If I comment out the DatabaseManager(self).
shutdown() line, the results of the upgrade are there.
So to me, this looks like a bug in trac.
That should probably be fixed. I created a ticket for the issue:
https://trac.edgewall.org/ticket/12618

- Ryan
--
You received this message because you are subscribed to the Google Groups "Trac Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-dev+***@googlegroups.com.
To post to this group, send email to trac-***@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-dev.
For more options, visit https://groups.google.com/d/optout.
Jeffrey Ratcliffe
2016-11-15 17:43:51 UTC
Permalink
Post by RjOllos
Tests are passing with in-memory SQLite database after r15965.
https://trac-hacks.org/changeset/15965
Confirmed. Thanks for that.

Regards

Jeff
--
You received this message because you are subscribed to the Google Groups "Trac Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-dev+***@googlegroups.com.
To post to this group, send email to trac-***@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-dev.
For more options, visit https://groups.google.com/d/optout.
Loading...