~nataliabidart/software-center/winged-migration

« back to all changes in this revision

Viewing changes to tests/gtk3/test_recommendations_widgets.py

  • Committer: Natalia B. Bidart
  • Date: 2012-05-30 18:39:55 UTC
  • mto: This revision was merged to the branch mainline in revision 3030.
  • Revision ID: natalia.bidart@canonical.com-20120530183955-zbnjczayktmmg5tv
- Initial test cleanup:
  - Renamed test/ dir to tests/.
  - Isolated test code into tests/ directory, including moving all the
    get_test_window_foo from the gtk3 production modules to
    tests/gtk3/windows.py module.
  - Removed all the calls to Gtk.main() in gtk3 tests since that blocks the
    execution of the suite.
  - Pep8 and pyflakes fixes in the files already modified in this branch.
  - Minor bug fix in the softwarecenter/log.py module when trying to create a
    log dir with proper perms.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
 
 
3
 
from gi.repository import Gtk, GObject
4
1
import unittest
5
2
 
6
 
from testutils import setup_test_env
 
3
from tests.utils import setup_test_env
7
4
setup_test_env()
8
5
 
9
 
from softwarecenter.ui.gtk3.widgets.recommendations import get_test_window
 
6
from tests.gtk3.windows import get_test_window_recommendations
10
7
 
11
 
# window destory timeout
12
 
TIMEOUT=100
13
8
 
14
9
# FIXME: the code from test_catview that tests the lobby widget should
15
10
#        move here as it should be fine to test it in isolation
17
12
class TestRecommendationsWidgets(unittest.TestCase):
18
13
 
19
14
    def test_recommendations_lobby(self):
20
 
        win = get_test_window(panel_type="lobby")
21
 
        win.show_all()
22
 
        GObject.timeout_add(TIMEOUT, lambda: win.destroy())
23
 
        Gtk.main()
24
 
        
 
15
        win = get_test_window_recommendations(panel_type="lobby")
 
16
        self.addCleanup(win.destroy)
 
17
 
25
18
    def test_recommendations_category(self):
26
 
        win = get_test_window(panel_type="category")
27
 
        win.show_all()
28
 
        GObject.timeout_add(TIMEOUT, lambda: win.destroy())
29
 
        Gtk.main()
30
 
        
 
19
        win = get_test_window_recommendations(panel_type="category")
 
20
        self.addCleanup(win.destroy)
 
21
 
31
22
    def test_recommendations_details(self):
32
 
        win = get_test_window(panel_type="details")
33
 
        win.show_all()
34
 
        GObject.timeout_add(TIMEOUT, lambda: win.destroy())
35
 
        Gtk.main()
36
 
 
 
23
        win = get_test_window_recommendations(panel_type="details")
 
24
        self.addCleanup(win.destroy)
37
25
 
38
26
 
39
27
if __name__ == "__main__":
40
 
    #import logging
41
 
    #logging.basicConfig(level=logging.DEBUG)
42
28
    unittest.main()