Code Functions

Main GUI

Watch for changes in all .py files. If changes, run nosetests.

tk_nosy.main_gui.ShowError(title='Title', message='your message here.')

Simply wraps the tkinter function of the “same” name.

tk_nosy.main_gui.ShowWarning(title='Title', message='your message here.')

Simply wraps the tkinter function of the “same” name.

class tk_nosy.main_gui.Tk_Nosy(master)

This class is the tkinter GUI object

Alarm()

Look for changed files every second, then reset alarm

AskDirectory(title='Choose Directory', initialdir='.')

Run pop-up menu for user to select directory.

Master_Configure(event)

Part of tkinter main window initialization

Pass_Fail_Button_Click(event)

Routine for user clicking Pass/Fail Button

SetAlarm(milliseconds=1000)

Reinitialize tkinter alarm mechanism as well as update seconds counter in main window title bar.

bindConfigure(event)

Part of goofy main window setup in tkinter.

callNosy()

Run nosetests and display results

changePythonVersion()

Change to a different python version. If the PyInterpsOnSys object (pythonInterpreterCollection) has been initialized, select from its list. Otherwise find the python interpreter executable (ex. python.exe or python)

change_python_exe(full_path)

Allow nosetests to be run under any available python version

findNewPythonInterpreter()

Find a new python interpreter, one that is not already in the PyInterpsOnSys object (pythonInterpreterCollection).

kill_popup_window(popup_name)

Close a popup window running another versions of python interpreter

launchAnotherPythonInterpreter()

Launch a pop-up window that concurrently runs another python version

menu_Directory_Change_Dir()

Menu selection to set directory in which to run nosetests

menu_Run()

User initiates a nosetests run, not file change detection.

reset_statusbar_bg()

Return status bar to default state

run_tkwin_nosetests(PI, tkwindow)
Run nosetests for main python interpreter and any concurrent
python interpreters.

Update GUI to show results.

set_statusbar_bg(c)

Set status bar to show new color and message

try_change_to_new_dir(dirname)

A legal abspath will switch to dirname.

tk_nosy.main_gui.main()

Run Main Window

tk_nosy.main_gui.numberOfChangedFiles(dirname)

Return number of .py files that have changed since last check.

tk_nosy.main_gui.run_nosetests(numNosyCalls, PI, display_test_details='Y')

Run nosetests, create xml file of output, parse the xml file to determine the results.

Return the results to the calling method.

Parameters:
  • numNosyCalls (int) – counter for total runs of nosetests
  • PI (object) – PyInterp object holding information of which python interpreter to run nosetests with
tk_nosy.main_gui.walkLocate(pattern, topDir='.')

Locate all files matching supplied filename pattern in and below supplied topDir directory.

Python Interpreters

PyInterpreters finds all python executable interpreters on this file system.


Maintains a list of python interpreters on this file system.

Will execute each interpreter (via subprocess.Popen) in order to get its version number

Also executes nosetests, if present, to get its version number.

PyInterpreters Copyright (C) 2015 Charlie Taylor

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.


class tk_nosy.pyterps.PyInterp(major, minor, micro, full_path)

PyInterp is a python executable interpreter on this file system.

Attributes:

major: major version of python interpreter
minor: minor version of python interpreter
micro: micro version of python interpreter
version_str: string representation of version (ex. 2.7.9)
is_pypy: boolean flag. True=pypy, False=CPython
nose_version: string representation of nose version (ex. 1.3.7)
(ex. C:\Python34\Scripts\nosetests.exe or nosetests3)

full_path: absolute path to the interpreter
(ex. C:\Python27\python.exe  or  /usr/bin/python3.4)
exe_path: the path portion of full_path (ex. C:\Python27  or /usr/bin)
exe_name: the file name portion of full_path (ex. python.exe  or python3.4)
name()

Name of interpreter is its version number (if PYPY then name is “PYPY ” + version number)

class tk_nosy.pyterps.PyInterpsOnSys(extra_search_dirL=None)

PyInterpreters finds all python executable interpreters on this file system.

Attributes:

interpL: list of PyInterp objects
interp2L: list of python 2 PyInterp objects
interp3L: list of python 3 PyInterp objects
add_interp(py_exe_cmd)

Adds a python interpreter to the collection

get_PI_list(removeNameL=None)

Return a list of interpreters, but w/o any members of removeNameL.

get_PI_obj_by_name(name)

Get a PI object using only it’s name. (ex. 3.4.5 or PYPY2.6.6)

get_PI_obj_by_py_path(py_path)

Get a PI object using only it’s full_exe_path. (ex. C:Python27python.exe or /usr/bin/python3.4)

num_terps()

Return the total number of python interpreters found on system.

tk_nosy.pyterps.get_nose_version_info(python_full_exe_path)

import nose in order to get the nose version number

tk_nosy.pyterps.get_py_version_info(python_full_exe_path)

import nose in order to get the nose version number

Popup Windows

SatelliteWindow is used to display nosetests results of concurrently run python interpreters.

class tk_nosy.tk_nosy_popup.SatelliteWindow(main_gui, MainWin, mytitle, dx=30, dy=30)

SatelliteWindow is used to display nosetests results of concurrently run python interpreters.

Pass_Fail_Button_Click(event)

Place-holder routine for user clicking Pass/Fail Button

cleanupOnQuit()

When closing popup, do a little clean up.

reset_statusbar_bg()

Return status bar to default state

set_statusbar_bg(c)

Set status bar to show new color and message

tk_nosy.tk_nosy_popup.main()

Launches CLI test fixture