Mercurial > p > roundup > code
view test/session_common.py @ 6524:f961dbbc3573
issue2551167 roundup issues when using pip install
Running pip install generates a wheel install. This places locale,
template and man pages under site-packages/usr/share/....
These changes make roundup look there for templates (affecting
admin.py) and locale (affecting i18n.py) files. This also makes it
work better in virtual environment and containers (docker).
There is also a commented out bit of code in setup.py that prevents it
from making a bdist_wheel forcing a regular install with files put
under /usr/locale etc. This can be re-enabled if needed for 2.2 if
there are still issues with roundup that aren't solved by then.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 07 Nov 2021 01:49:03 -0400 |
| parents | 95a366d46065 |
| children | 044dcf3608a2 |
line wrap: on
line source
import os, shutil, unittest from .db_test_base import config class SessionTest(object): def setUp(self): # remove previous test, ignore errors if os.path.exists(config.DATABASE): shutil.rmtree(config.DATABASE) os.makedirs(config.DATABASE + '/files') self.db = self.module.Database(config, 'admin') self.sessions = self.db.getSessionManager() self.otks = self.db.getOTKManager() def tearDown(self): if hasattr(self, 'db'): self.db.close() if os.path.exists(config.DATABASE): shutil.rmtree(config.DATABASE) def testList(self): self.sessions.list() self.sessions.set('random_key', text='hello, world!') self.sessions.list() def testGetAll(self): self.sessions.set('random_key', text='hello, world!') self.assertEqual(self.sessions.getall('random_key'), {'text': 'hello, world!'}) def testDestroy(self): self.sessions.set('random_key', text='hello, world!') self.assertEqual(self.sessions.getall('random_key'), {'text': 'hello, world!'}) self.sessions.destroy('random_key') self.assertRaises(KeyError, self.sessions.getall, 'random_key') def testSetSession(self): self.sessions.set('random_key', text='hello, world!') self.assertEqual(self.sessions.get('random_key', 'text'), 'hello, world!') def testUpdateSession(self): self.sessions.set('random_key', text='hello, world!') self.assertEqual(self.sessions.get('random_key', 'text'), 'hello, world!') self.sessions.set('random_key', text='nope') self.assertEqual(self.sessions.get('random_key', 'text'), 'nope')
