Eisenhaus335 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404076 )
Change subject: Create Module Tests ...................................................................... Create Module Tests Change-Id: Ic756dc4f027287589f4b76d98319c321545ec97d --- A tests/daemonize_tests.py A tests/editor_tests.py 2 files changed, 74 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/76/404076/1 diff --git a/tests/daemonize_tests.py b/tests/daemonize_tests.py new file mode 100644 index 0000000..69c821e --- /dev/null +++ b/tests/daemonize_tests.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +"""Tests for BasePage subclasses.""" + +from __future__ import absolute_import, unicode_literals + +import os + +import unitest + +from pywikibot import daemonize + + +def test_daemonize_os_exit(): + os.fork() + os.fork() + daemonize.daemonize() + daemonize.daemonize() + + +def test_daemonize_closedstream_true(): + daemonize.daemonize(True, True, False, None) + + +def test_daemonize_closedstream_false(): + daemonize.daemonize(False, True, False, None) + + +def test_daemonize_changedirectory_true(): + daemonize.daemonize(True, True, False, None) + + +def test_daemonize_changeddirectory_false(): + daemonize.daemonize(True, False, False, None) + + +def test_redirectstd_true(): + daemonize.daemonize(True, True, False, 'Test') + + +def test_daemonize_writepid_True(): + os.fork() + # cannot be tested because spaghetti code + + +if __name__ == '__main__': # pragma: no cover + try: + unitest.main() + except SystemExit: + pass diff --git a/tests/editor_tests.py b/tests/editor_tests.py new file mode 100644 index 0000000..88fd8bb --- /dev/null +++ b/tests/editor_tests.py @@ -0,0 +1,25 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +"""Test Editor.""" + +from __future__ import absolute_import, unicode_literals + +import os + +import tempfile + +from pywikibot import editor + + +def test_editor_edituserconfigpy_same(): + editor.TextEditor.edit(text=None, jumpIndex=200, highlight='test1') + + +def test_editor_edituserconfigpy(): + editor.TextEditor.edit(text='test1', jumpIndex=200, highlight='test1') + + +def test_editor_command(): + tempfile.TemporaryFile(suffix='test', prefix='txt', dir=os.getcwd()) + editor.TextEditor.command(tempFilename=os.getcwd() + 'test.txt', + text='test') -- To view, visit https://gerrit.wikimedia.org/r/404076 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic756dc4f027287589f4b76d98319c321545ec97d Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Eisenhaus335 <greenzone...@outlook.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits