[pitivi] tests_: Use nose2 instead of nosetests



commit 6b144a5194510353c638f816d609ccf71d2ce1f7
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Wed Aug 17 21:37:25 2016 +0200

    tests_: Use nose2 instead of nosetests
    
    Also do not run the tests if the runner is not found.
    
    Reviewed-by: Thibault Saunier <tsaunier gnome org>
    Differential Revision: https://phabricator.freedesktop.org/D1285

 build/flatpak/pitivi.template.json |    4 +-
 tests/meson.build                  |   80 ++++++++++++++++++------------------
 tests/nose2-junit-xml.cfg.in       |    3 +
 3 files changed, 45 insertions(+), 42 deletions(-)
---
diff --git a/build/flatpak/pitivi.template.json b/build/flatpak/pitivi.template.json
index 72bb385..a867e73 100644
--- a/build/flatpak/pitivi.template.json
+++ b/build/flatpak/pitivi.template.json
@@ -132,11 +132,11 @@
             ]
         },
         {
-            "name": "nose",
-            "config-opts": ["--module=nose==1.3.7"],
+            "name": "nose2",
             "build-options" : {
               "build-args": ["--share=network"]
             },
+            "config-opts": ["--module=nose2==0.6.5"],
             "sources": [
                 {
                     "type": "file",
diff --git a/tests/meson.build b/tests/meson.build
index b094902..6be62da 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,43 +1,43 @@
-runtests = find_program('nosetests3', required : false)
-# On some distros it doesn't have the '3' suffix
-if not runtests.found()
-    runtests = find_program('nosetests', required : false)
-endif
+runtests = find_program('nose2', required : false)
 
-testdir = '@0@'.format(meson.current_source_dir())
+if runtests.found()
+    tests = [
+        ['Test application module', 'test_application'],
+        ['Test check module', 'test_check'],
+        ['Test clipproperties', 'test_clipproperties'],
+        ['Test common utilities', 'test_common'],
+        ['Test logging subsystem', 'test_log'],
+        ['Test the main window', 'test_mainwindow'],
+        ['Test the media library', 'test_media_library'],
+        ['Test the misc utilities', 'test_misc'],
+        ['Test the pipeline', 'test_pipeline'],
+        ['Test the preference dialog', 'test_prefs'],
+        ['Test presets', 'test_preset'],
+        ['Test the previewer', 'test_previewers'],
+        ['Test the project', 'test_project'],
+        ['Test the keyboard shortcuts', 'test_shortcuts'],
+        ['Test system integration', 'test_system'],
+        ['Test graphical timeline elements', 'test_timeline_elements'],
+        ['Test graphical layers', 'test_timeline_layer'],
+        ['Test the graphical timeline', 'test_timeline_timeline'],
+        ['Test undo/redo for the project', 'test_undo_project'],
+        ['Test the undo subsystem', 'test_undo'],
+        ['Test undo/redo in the timeline', 'test_undo_timeline'],
+        ['Test utilities', 'test_utils'],
+        ['Test the timeline utilities', 'test_utils_timeline'],
+        ['Test our compound widget', 'test_widgets']
+    ]
 
-tests = [
-    ['Test application module', 'test_application.py'],
-    ['Test check module', 'test_check.py'],
-    ['Test clipproperties', 'test_clipproperties.py'],
-    ['Test common utilities', 'test_common.py'],
-    ['Test logging subsystem', 'test_log.py'],
-    ['Test the main window', 'test_mainwindow.py'],
-    ['Test the media library', 'test_media_library.py'],
-    ['Test the misc utilities', 'test_misc.py'],
-    ['Test the pipeline', 'test_pipeline.py'],
-    ['Test the preference dialog', 'test_prefs.py'],
-    ['Test presets', 'test_preset.py'],
-    ['Test the previewer', 'test_previewers.py'],
-    ['Test the project', 'test_project.py'],
-    ['Test the keyboard shortcuts', 'test_shortcuts.py'],
-    ['Test system integration', 'test_system.py'],
-    ['Test graphical timeline elements', 'test_timeline_elements.py'],
-    ['Test graphical layers', 'test_timeline_layer.py'],
-    ['Test the graphical timeline', 'test_timeline_timeline.py'],
-    ['Test undo/redo for the project', 'test_undo_project.py'],
-    ['Test the undo subsystem', 'test_undo.py'],
-    ['Test undo/redo in the timeline', 'test_undo_timeline.py'],
-    ['Test utilities', 'test_utils.py'],
-    ['Test the timeline utilities', 'test_utils_timeline.py'],
-    ['Test our compound widget', 'test_widgets.py']
-]
+    foreach i: tests
+        args = ['-t', meson.source_root(), '-s', meson.current_source_dir()]
+        if get_option('enable-xunit')
+            xunitfile = '' + i.get(0).underscorify() + '.xunit'
+            config = configuration_data()
+            config.set('path', xunitfile)
+            configure_file(input : 'nose2-junit-xml.cfg.in', configuration : config, output : xunitfile + 
'.cfg')
+            args = args + ['--plugin', 'nose2.plugins.junitxml', '--config', meson.current_build_dir() + '/' 
+ xunitfile + '.cfg']
+        endif
 
-foreach i: tests
-    args = []
-    if get_option('enable-xunit')
-        args = ['--with-xunit', '--xunit-file=' + i.get(0).underscorify() + '.xunit']
-    endif
-
-    test(i.get(0), runtests, args: args + [testdir + '/' + i.get(1)])
-endforeach
+        test(i.get(0), runtests, args: args + ['tests.' + i.get(1)])
+    endforeach
+endif
\ No newline at end of file
diff --git a/tests/nose2-junit-xml.cfg.in b/tests/nose2-junit-xml.cfg.in
new file mode 100644
index 0000000..335e33d
--- /dev/null
+++ b/tests/nose2-junit-xml.cfg.in
@@ -0,0 +1,3 @@
+[junit-xml]
+always-on = True
+path = @path@


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]