Giter Club home page Giter Club logo

cricket's Introduction

logo

BeeWare

Python Versions PyPI Version Maturity BSD License Build Status Discord server

BeeWare is a collection of tools and libraries for building and distributing native applications in Python.

For an introduction to the full BeeWare suite, we recommend running the BeeWare Tutorial.

Community

You can talk to the BeeWare community through:

We foster a welcoming and respectful community as described in our BeeWare Community Code of Conduct.

Contributing

If you experience problems with BeeWare, log them on GitHub. If you want to contribute code, please fork the code and submit a pull request.

Translations

Translation status

We manage translations using Weblate.

Translation status

If you'd like to contribute to the translation effort, join the #translations channel on Discord and introduce yourself!

cricket's People

Contributors

bachmann1234 avatar charettes avatar danyeaw avatar dayof avatar drewbrew avatar drmeers avatar flowerncsu avatar freakboy3742 avatar funkybob avatar gopar avatar idahogray avatar jacebrowning avatar lensvol avatar r1chardj0n3s avatar ratanshreshtha avatar serdardalgic avatar stephenmcd avatar therealphildini avatar treyhunner avatar willingc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cricket's Issues

AttributeError: 'TestMethod' object has no attribute 'items'

Traceback (most recent call last):
  File "C:\Users\Cole Jancsar\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\Cole Jancsar\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Cole Jancsar\Desktop\Testing practice\obey_goat_project\venv\Scripts\cricket-django.exe\__main__.py", line 9, in <module>
  File "c:\users\cole jancsar\desktop\testing practice\obey_goat_project\venv\lib\site-packages\cricket\django\__main__.py", line 9, in main
    cricket_main(DjangoProject)
  File "c:\users\cole jancsar\desktop\testing practice\obey_goat_project\venv\lib\site-packages\cricket\main.py", line 90, in main
    view.project = project
  File "c:\users\cole jancsar\desktop\testing practice\obey_goat_project\venv\lib\site-packages\cricket\view.py", line 509, in project
    self._add_test_module('', testModule)
  File "c:\users\cole jancsar\desktop\testing practice\obey_goat_project\venv\lib\site-packages\cricket\view.py", line 490, in _add_test_module
    for testMethod_name, testMethod in sorted(testCase.items()):
AttributeError: 'TestMethod' object has no attribute 'items'

Add support for nose (standalone and for Django)

I thought it makes sense to open an issue for this so that we can keep track of progress and discussion points.

I finally managed to get a POC discoverer for nose up and running which means it is not far of. It looks like there'll be enough overlap between the generic and Django-specific nose runner to work on both simultaneously. One slight annoyance, however, will be that for Django + nose, we'll need to have a separate Discoverer that is used in place of the existing one. There's two ways of handling that:

  1. Check in the discover_commandline of DjangoProject for the used test runner in settings and switch between the default or nose one
  2. Have a separate project in cricket.django.nose that overrides DjangoProject where appropriate.

There might also be alternatives to those two that I don't see. I personally think that 2. is the more appealing solution. What are your thought?

I'll update here and attach a PR as soon as I get a first version hammered out.

Add ability to reload test suite without restarting cricket

I've been using cricket-unittest with pyramid for some time. It's a great piece of software, but I've noticed it's missing a feature that would greatly improve it's usability.

When adding/removing test cases cricket needs to be restarted in order to reload all the tests. It would be much more convenient if there would be a button somewhere in cricket window that would reload all tests.

Unable to exit cricket gui

When I run python -m cricket.django on a location with no django-project, it opens up a pop-up stating python: can't open file 'manage.py': [Errno 2] No such file or directory.
This pop-up blocks the control on the main window and the app cannot be exited.
The pop-up can be closed, but being run on a loop, another pop-up opens up and you are stuck in this situation. Killing the respective python process from the terminal is the workaround.

Add cmd line option for directory to inspect

Is your feature request related to a problem? Please describe.
cricket discovers all tests under the current directory. I then end up with > 300 unittests shows, while I'm only interested in one single module.

Describe the solution you'd like
An equivalent of python -m unittest discover [module name] from command line.

Describe alternatives you've considered
No real ones.
I can only start cricket in the main dir and then minimize all test modules until I find my module of interest.

'TestCase' object has no attribute 'timestamp'

On current Django master (django/django@1918882) I get a failure when running cricket-unittest from inside the tests directory:

Traceback (most recent call last):
  File "/home/markus/.venvs/django-dev-py27/bin/cricket-unittest", line 9, in <module>
    load_entry_point('cricket==0.2.3', 'console_scripts', 'cricket-unittest')()
  File "/home/markus/.venvs/django-dev-py27/lib/python2.7/site-packages/cricket/unittest/__main__.py", line 9, in main
    cricket_main(UnittestProject)
  File "/home/markus/.venvs/django-dev-py27/lib/python2.7/site-packages/cricket/main.py", line 72, in main
    project.refresh(test_list, errors)
  File "/home/markus/.venvs/django-dev-py27/lib/python2.7/site-packages/cricket/model.py", line 506, in refresh
    testModule._purge(timestamp)
  File "/home/markus/.venvs/django-dev-py27/lib/python2.7/site-packages/cricket/model.py", line 381, in _purge
    testModule._purge(timestamp)
  File "/home/markus/.venvs/django-dev-py27/lib/python2.7/site-packages/cricket/model.py", line 381, in _purge
    testModule._purge(timestamp)
  File "/home/markus/.venvs/django-dev-py27/lib/python2.7/site-packages/cricket/model.py", line 381, in _purge
    testModule._purge(timestamp)
  File "/home/markus/.venvs/django-dev-py27/lib/python2.7/site-packages/cricket/model.py", line 242, in _purge
    if testMethod.timestamp != timestamp:
AttributeError: 'TestCase' object has no attribute 'timestamp'

"ValueError: No JSON object could be decoded" on 'Run all' an empty test list

Sure, not very useful to 'Run all' an empty test tree :) but ....
Just because on command line I'm used to run manage.py test myapp
and it's not so explicit in the Django doc that I have to create myself a project/tests.py containing from myapp.tests import *.

cricket-django.exe

Exception in Tkinter callback
Traceback (most recent call last):
  File "D:\Python27\lib\lib-tk\Tkinter.py", line 1486, in __call__
    return self.func(*args)
  File "D:\Python27\lib\lib-tk\Tkinter.py", line 533, in callit
    func(*args)
  File "D:\Python27\lib\site-packages\cricket-0.2.4.dev-py2.7.egg\cricket\view.py", line 784, in on_testProgress
    if self.executor and self.executor.poll():
  File "D:\Python27\lib\site-packages\cricket-0.2.4.dev-py2.7.egg\cricket\executor.py", line 225, in poll
    pre = json.loads(line)
  File "D:\Python27\lib\json\__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "D:\Python27\lib\json\decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "D:\Python27\lib\json\decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

Subclassing

The tree structure of cricket is this

directory/file/classes/testmethods

is it possible to have a level between classes and testmethods, so subclasses?

Missing dep in packaging?

$ pip install cricket
Downloading/unpacking cricket
Downloading cricket-0.1.0.tar.gz
Running setup.py egg_info for package cricket

Installing collected packages: cricket
Running setup.py install for cricket

Successfully installed cricket
Cleaning up...

$ python -m cricket.django
Traceback (most recent call last):
...
File ".../lib/python2.7/site-packages/cricket/widgets.py", line 1, in
from idlelib.WidgetRedirector import WidgetRedirector
ImportError: No module named idlelib.WidgetRedirector

Correct CI configuration

The current development branch of Cricket is failing CI because:

  • It requires Toga 0.3, which is still in development
  • Toga is defaults to the platform-appropriate backend, which is GTK on CI.

We need to modify the Beekeeper image and configuration to support installing a development version of Toga, and running the tests using the toga-dummy platform backend.

package dependencies

So I'm not a distribute expert, but...

-- Need to add the cricket.unittest as a provided package
-- Need to add the 'mock' module as a package dependency
(see unittest.loader.ModuleImportFailure.tests.test_models)

Error when running single test case

It's OK if choose "run all" or "run selected" with the script file selected, but when I choose a test case then click "run selected", an error occured:

Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 399, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/test.py", line 50, in run_from_argv
super(Command, self).run_from_argv(argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(_args, *_options.dict)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/test.py", line 71, in execute
super(Command, self).execute(_args, *_options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 285, in execute
output = self.handle(_args, *_options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/test.py", line 88, in handle
failures = test_runner.run_tests(test_labels)
File "/usr/local/lib/python2.7/dist-packages/django/test/runner.py", line 144, in run_tests
suite = self.build_suite(test_labels, extra_tests)
File "/usr/local/lib/python2.7/dist-packages/django/test/runner.py", line 63, in build_suite
tests = self.test_loader.loadTestsFromName(label)
File "/usr/lib/python2.7/unittest/loader.py", line 91, in loadTestsFromName
module = import('.'.join(parts_copy))
ImportError: No module named myapp

Import Error: Cannot find module runners

The file cricket/django/models.py seems to point at the test runner "cricket.django.runners.TestExecutor" when it should actually be "cricket.django.executor.TestExecutor".

Console output for failed tests

This seems like a great tool, but lacking a key feature for me:

The normal test runner outputs to the console in a format that can be parsed by IDEs, allowing you to jump right to the line where you have an error (failed assertion or exception). For example, in Emacs:

http://lukeplant.me.uk/uploads/Screenshot_from_2014-03-31_20_29_37.png

If there was an option for cricket to dump the same output stdout when it ran tests (as they failed - not waiting for the end), this would allow it to be a fantastic drop-in replacement for the normal test runner that keeps the best of both worlds.

Thanks!

Undefined name 'child'

flake8 testing of https://github.com/pybee/cricket on Python 3.7.1

$ flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics

./cricket/model.py:68:36: F821 undefined name 'child'
        self._child_nodes[label] = child
                                   ^
./cricket/model.py:70:45: F821 undefined name 'child'
        self._source._notify('remove', item=child)
                                            ^
2     F821 undefined name 'child'
2

E901,E999,F821,F822,F823 are the "showstopper" flake8 issues that can halt the runtime with a SyntaxError, NameError, etc. These 5 are different from most other flake8 issues which are merely "style violations" -- useful for readability but they do not effect runtime safety.

  • F821: undefined name name
  • F822: undefined name name in __all__
  • F823: local variable name referenced before assignment
  • E901: SyntaxError or IndentationError
  • E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree

Vanilla cricket install fails under Windows + Python 2.6.6

At the moment cricket implicitly relies on ttk and unittest from 2.7, which causes install from PyPi to fail:

Traceback (most recent call last):
...
File "D:\Projects\env\kinder\Lib\site-packages\cricket\django__main__.py", line 4, in
from cricket.main import main as cricket_main
File "D:\Projects\env\kinder\Lib\site-packages\cricket\main.py", line 11, in
from cricket.view import (
File "D:\Projects\env\kinder\Lib\site-packages\cricket\view.py", line 8, in
from ttk import *
ImportError: No module named ttk

After that it fails because of changed module structure in unittest from 2.7:

File "D:\Projects\env\kinder\Lib\site-packages\cricket\django__main__.py", line 4, in
from cricket.main import main as cricket_main
File "D:\Projects\env\kinder\Lib\site-packages\cricket\main.py", line 11, in
from cricket.view import (
File "D:\Projects\env\kinder\Lib\site-packages\cricket\view.py", line 16, in
from cricket.executor import Executor
File "D:\Projects\env\kinder\Lib\site-packages\cricket\executor.py", line 13, in
from cricket.pipes import PipedTestResult, PipedTestRunner
File "D:\Projects\env\kinder\Lib\site-packages\cricket\pipes.py", line 40, in
class PipedTestResult(unittest.result.TestResult):
AttributeError: 'module' object has no attribute 'result'

This because in old unittest TestResult> was import from unittest directly, while in >2.7 it needs to be imported from unittest.result.

While ImportError with ttk can be fixed relatively straightforward with adding pyttk to REQUIREMENTS, I'm not sure how to deal with unittest situation.

Possible solution seems to be falling back to unittest2:

import sys
if sys.version_info < (2, 7):
     try:
          import unittest2 as unittest
     except ImportError:
          print "cricket relies on changes introduced into unittest in Python 2.7.\n"\
                 "You can install backported version from PyPi:\n\tpip install unittest2"
          sys.exit(0)

But it seems somewhat hacky. :(

cricket-pytest Windows 10 "Unhandled Exception: Python.Runtime.PythonException: SystemExit : 1"

Hi I'm trying to launch criket-pytest on Win10 system and facing the following issue (tried with the empty tests folder and with the tests within it):

(3.7.2) C:\Projects\venvs\tests>cricket-pytest
[Winforms] Not implemented: TextInput.set_font()
[Winforms] Not implemented: TextInput.set_font()
[Winforms] Not implemented: TextInput.set_font()
[Winforms] Not implemented: TextInput.set_font()
[Winforms] Not implemented: TextInput.set_font()
[Winforms] Not implemented: TextInput.set_font()
[Winforms] Not implemented: TextInput.set_font()
[Winforms] Not implemented: TextInput.set_font()
[Winforms] Not implemented: TextInput.set_font()
[Winforms] Not implemented: TextInput.set_font()
[Winforms] Not implemented: MultilineTextInput.set_placeholder()
[Winforms] Not implemented: MultilineTextInput.set_placeholder()
[Winforms] Not implemented: MultilineTextInput.set_placeholder()
[Winforms] Not implemented: Tree.change_source()
[Winforms] Not implemented: Tree.set_on_select()
[Winforms] Not implemented: Tree.set_on_select()
[Winforms] Not implemented: Tree.change_source()
[Winforms] Not implemented: Tree.set_on_select()
[Winforms] Not implemented: Tree.set_on_select()
[Winforms] Not implemented: OptionContainer.set_on_select()
[Winforms] Not implemented: OptionContainer.set_on_select()

Unhandled Exception: Python.Runtime.PythonException: SystemExit : 1
   at Python.Runtime.Dispatcher.Dispatch(ArrayList args)
   at __System_Threading_ThreadStartDispatcher.Invoke()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

I installed pythonnet with
pip install git+https://github.com/pythonnet/pythonnet.git
and then cricket with:
pip install git+https://github.com/pybee/cricket.git
After that I had to fix cricket\view.py on line 14, because I got the following error:

  File "c:\projects\venvs\3.7.2\lib\site-packages\cricket\view.py", line 14, in <module>
    from toga.font import BOLD, SANS_SERIF
ModuleNotFoundError: No module named 'toga.font'

The fix was renaming toga.font to toga.fonts.

System: Windows 10 64bit, Python 3.7.2

(3.7.2) C:\Projects\venvs\tests>pip freeze
cricket==0.3.0.dev1
pythonnet==2.4.0.dev0
toga==0.3.0.dev11
toga-core==0.3.0.dev11
toga-winforms==0.3.0.dev11
travertino==0.1.2

On Windows 7 I was able at least to run the application, but the tests were not loaded (more info in #77 )

Any help will be highly appreciated because cricket seems to be an excellent tool, but I was able to run it only on MacOS so far which is not enough.

Print statements in the code will cause an exception in cricket

Print statements in the test or source code being tested will cause cricket to stop working and throw the following exception.

Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1473, in __call__
    return self.func(*args)
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 534, in callit
    func(*args)
  File "/home/benk/workspace/swcc/VirtualEnv/local/lib/python2.7/site-packages/cricket/view.py", line 706, in on_testProgress
    if self.executor and self.executor.poll():
  File "/home/benk/workspace/swcc/VirtualEnv/local/lib/python2.7/site-packages/cricket/executor.py", line 133, in poll
    post = json.loads(self.buffer[1])
  File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 365, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 383, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

The Test being run is

from django.core.urlresolvers import reverse

from django.utils import unittest
from django.test.client import Client


class StaticPageTestCase(unittest.TestCase):

    def setUp(self):
        self.client = Client()

    def test_disclaimer_page(self):
        self.client.login(username='admin', password='password')
        """Disclaimer page can be rendered."""
        response = self.client.get(reverse('disclaimer'))
        self.assertEqual(response.status_code, 200)
        print 'fozzy'

The contents of the buffer on executor.py line 133 is

['{"path": "swcc.StaticPageTestCase.test_disclaimer_page", "start_time": 1375254062.688251}', 'fozzy', '{"status": "OK", "output": "", "end_time": 1375254063.314388, "description": "No description"}']

A possible (temporary) workaround is to modify line 133 of executor.py to read

post = json.loads(self.buffer[-1])

(GSoC) Port Cricket to use Toga, instead of Tkinter

Table of content

  1. Abstract 1.1 Drawbacks of the existing GUI framework 1.2 Goals 1.3 Benefits
  2. The new framework 2.1 Overview 2.2 Advantages
  3. Schedule and milestones 3.1 Prepare the field 3.2 Port Cricket to use Toga 3.3 Usage documentation 3.4 If time permits...
  4. About me

1 Abstract

1.1 Drawbacks of the existing GUI framework

Cricket's GUI interface is currently implemented using Tkinter, which has a lot of limitations. For example: Tkinter has no built-in table widget, while Toga does. Tkinter does not support CSS properties for styling the objects, while Toga supports because of the Colosseum framework, the (partial) implementation of the CSS box and the flexbox layout algorithm. Also, the Toga project is very active, the community is always developing and fixing issues, and looks / feels like a native app for multiple platforms.

1.2 Goals

The main goal is the complete port of Cricket to use Toga as the framework for GUI interface. The base logic is mostly complete, so firstly I will plan how to adapt the actual architecture of the view to use Toga widgets. If I find one widget that Cricket uses but isn't implemented on Toga, I will develop a contribution to this specific widget. This way the application will not lose the basics layout.

So, the proposal will not only focus on the port of Tkinter to Toga, but on mapping the necessary widgets for a real application using Toga framework.

1.3 Benefits

In addition of the advantages of using Toga instead of Tkinter as I highlighted on section 1.1, this is a opportunity to improve error handling and make better use of features that Toga has but Tkinter does not. It will be the first BeeWare project that “eats it is own dogwood".

2 The new framework

2.1 Overview

The application logic core will be preserved, migrating only the objects of Tkinter to Toga widgets. Both Tkinter and Toga are event oriented so a redesign of the architecture will not happen.

Example of a simple migration of a widget object of Tkinter to Toga:

Tkinter:

  self.toolbar = Frame(self.root)
  self.toolbar.grid(column=0, row=0, sticky=(W, E))

  self.stop_button = Button(self.toolbar,
                            text='Stop',
                            command=self.cmd_stop,
                            state=DISABLED)
  self.stop_button.grid(column=0, row=0)

Toga:

  box = toga.Box()

  self.stop_button = toga.Button('Stop', on_press=self.cmd_stop, enabled=False)
  button.style.set(width=100, margin_left=10)

  box.add(button)

2.2 Advantages

At the example above we can already see the first advantage of the migration, the CSS usage, allowing more flexibility of the UI design. Also there are widgets that exist only in Toga, like the Table widget. More features can be added from this migration.

3 Schedule and milestones

I am going to two events during the GSOC, one during June 15th-18th and one during the period August 1st-5th. But these events are academic and will not prevent me from working there.

Also, it is important to cite the days that I will probably work half of the time because of the exams I will have on college:

  • June 1, 14, and 29
  • July 5, 6

3.1 Prepare the field -- first milestone (1 week)

(From May 30 until June 5)

Before starting coding there are a few important things to do around the first week:

  • Learn the architecture of Tkinter and Toga
  • Review alongside the mentor what is important to maintain from the base code
  • Which parts parts of Cricket would be good to add new features from Toga

3.2 Port Cricket to use Toga -- second milestone (9 weeks)

(From June 6 until August 7)

Each part of this milestone will follow a development process cycle: build, test and document. I will focus only on the Cocoa platform on each improvement or development of widgets on Toga. All modifications on Cricket will be made on the files view.py and on main.py. For Toga, the additions/modifications will be made on widgets folder.

To elaborate this section of the proposal I mapped each object used with Tkinter that exists in Toga, some objects need to be explored with more details but the next sub sections will focus on solving the development on a top-down view, solving the "easiest" problems first, such as adapting the complete widgets that exist on Toga already and is used on Cricket.

Aside from modifying the main file, since the GUI is separated on an independent class named MainWindow, there is no need to refactor any other class when the port is complete.

The average time cost to develop a widget was calculated from the time cost that the primary author from the Cricket project, Russell Keith-Magee, developed some new widget or feature to a specific platform (inferred from commits on GitHub), multiplied by 6 to estimate the time that I will take to develop.

3.2.1 Adapt the complete widgets that exist on Toga already and is used on Cricket (8.5 weeks)

3.2.1.1 Core Widgets (1.5 week)

The core widgets available on Toga are Application, Box, Font, Widget and Window, but I will need to adapt only 4 of them, since the utility of the class Widgets on Cricket will be defined later on Tree. The explanation is the following:

  • Application

Toga: This core widget is used to manage the main loop of the application and to control the other core widget, Window, setting the title, size and other properties of the main Window.

Tkinter: The title, geometry and other properties of the window on Tkinter also is setup on a core widget of the application, named root.

Result: This adaptation is possible.

  • Box

Toga: Box is a container for any widget, so other boxes can be added inside it as well. Also, with the Colosseum integration, the style is made with a partial CSS environment.

Tkinter: The closest similar object of Box on this framework would be the PanedWindow, which allows add other panes inside a bigger pane and modify the styles. The Frame widget is also similar.

Result: This adaptation is possible.

  • Font

Toga: Fonts of the labels, modify family and size.

Tkinter: Also allows to modify de family and size, but there are many other options, like, weight, underline, overstrike and slant.

Result: Since is not really necessary to add weight of label this adaptation is possible. If time permits I can add those new properties on Toga.

  • Widget

Toga: Base class for widgets, not instantiated directly.

Tkinter: Standard options and commands supported on all widgets. This module is used on Cricket as a event handler when a test case has been selected in the tree.

Result: These event handler explained above will be develop on another widget, Tree. So the adaptation will be made later.

  • Window

Toga: Display components to the user, support displaying multiple widgets, toolbars and resizing.

Tkinter: The class more similar to Window is the Frame together with the main class Tk. Then you can set the title on root window, add multiple widgets, toolbar and also resize.

Result: This adaptation is possible.

3.2.1.2 General Widgets (5.5 weeks)

The general widgets available on Toga are Button, Image View, Label, Multiline Text Input, Number Input, Option Container, Progress Bar, Selection, Text Input, Table and Tree, but I'll need adapt only 6 of them. I propose work on 2 widgets per week. The widgets that were cut off from adaptation are the following:

  • Image View

Toga: Container for an image to be rendered on the display.

Tkinter: Cricket doesn't use this feature.

Result: There is no need to adapt this widget.

  • Multiline Text Input

Toga: Similar to the text input but designed for larger inputs, similar to the text area field of HTML.

Tkinter: Cricket doesn't use this feature.

Result: There is no need to adapt this widget.

  • Number Input

Toga: Text input box that is limited to numeric input.

Tkinter: Similar to this class there is Entry, but it is a editable text field widget, not only for number. We'll adapt this kind of widget on Text Input.

Result: There is no need to adapt this widget.

  • Selection

Toga: A simple control for allowing the user to choose between a list of string options.

Tkinter: The class similar to this widget is OptionMenu, but Cricket doesn't use it.

Result: There is no need to adapt this widget.

  • Table

Toga: Display tabular data. It can be instantiated with the list of headings and then data rows can be added.

Tkinter: Doesn't exist this widget on Tkinter.

Result: There is no need to adapt this widget.

3.2.1.2.1 Basic General Widgets (1.5 week)
  • Button

Toga: Basic clickable button. It's possible to modify the label, event on press, state of disable or enable.

Tkinter: On Cricket the button of Tk is used with the same features that the button on Toga offers.

Result: This adaptation is possible.

  • Switch

Toga: Switch implements the basics features of the widget that Tkinter has.

Tkinter: They call this feature on Tkinter as Checkbutton.

Result: Probably will need some improvements, like commands and variables to Switch, but the basic adaptation is possible.

  • Label

Toga: A text-label for annotating forms or interfaces.

Tkinter: On Cricket the label of Tk is used with the same features that the label on Toga offers.

Result: This adaptation is possible.

3.2.1.2.2 Intermediate General Widgets (1 week)
  • Text Input

Toga: A simple input field for user entry of text data.

Tkinter: On Tkinter this widget will have 2 utilities, first to substitute Entry and second ReadOnlyText because there is a set_readonly method.

Result: This adaptation is possible.

  • Progress Bar

Toga: Simple widget for showing a percentage progress for task completion.

Tkinter: The important properties of Progress Bar are to set the value and the max to go. There are other properties that this widget have in addition on Tkinter, for example, length, orientation and mode.

Result: The basic implementation of this widget on Toga are enough to adapt on Cricket even without those properties that Tkinter has in advance.

3.2.1.2.3 Advance General Widgets (3 week)
  • Option Container

Toga: Is a user-selection control for choosing from a pre-configured list of controls, like a tab view.

Tkinter: There is the class for this on Tkinter, the Notebook, that is a multi-paned container widget.

Result: The object of Tkinter is used on Cricket with the same properties that are available on Toga, so this adaptation is possible.

  • Tree

Toga: A scrollable display of heirarchical data.

Tkinter: Hierarchical multicolumn data display widget.

Result: This adaptation is possible.

3.2.1.3 Layout Widgets (1.5 week)

The layout widgets available on Toga are Scroll Container, Split Container and Web View, but I will need adapt only 2 of them. The explanation is the following:

  • Scroll Container

Toga: Similar to the iframe or scrollable div element in HTML, it contains an object with its own scrollable selection.

Tkinter: Control the viewport of a scrollable widget.

Result: The final use of these two widget are the same, but the difference is that on Toga you add content on a scroll container and on Tkinter you add a scroll bar on a container, so this adaptation is possible.

  • Split Container

Toga: Is a container with a movable split and the option for 2 or 3 elements.

Tkinter: There is no similar widget on Tkinter like Split Container but on Cricket are simulate using two separated Frames.

Result: This adaptation is possible.

  • Web View

Toga: Displaying an embedded browser window within an application.

Tkinter: Cricket doesn't use this feature.

Result: There is no need to adapt this widget.

3.2.2 Finishing port (0.5 week)

3.3 Usage documentation -- last milestone (2 weeks)

(From August 8 until August 21)

On the tutorials are presented four basic tutorials of the current widgets and its features, but since we are going to add some new small modifications, it would be interesting to show their usage. For example, the new feature of enable/disable a button.

3.3.1 Add new tutorials with new features for Toga (1 week)

There are few widgets present on Toga but there are no basics examples on how to use them, so I will include a basic example of each new widgets that I'll develop on 3.2.1. For example, the widget to add menu and menu items proposed on 3.2.1.

If possible, I will add a tutorial for the other widgets that still lack a basic usage example.

3.4 If time permits...

There are some TODOs on Cricket, like improving GUI interface, including keyboard shortcuts and search, so, if time permits I will follow this sequence.

4 About me

My name is Dayanne Fernandes da Cunha, I'm an undergraduate student of Bachelor on Computer Science at University of Brasília (UnB), Brazil. My time zone is UTC-3. I program in Python for at least 3 years, I program also in C, C++, Java and Javascript. This is my very first experience on contribution for a open source project. I've already made 2 PR this month and I loved it!

Edit: The subsection Improvement of simple widgets on Toga (0.5 week) was removed because the Switch widget does what the CheckButton do. So the Switch was add on the General Widgets section, into Basic General Widgets, bellow the Button port. Also, the '0.5 week' was migrate to the Basic General Widgets subsection.

Edit2: The subsection Development of objects that exist on Cricket but still not implement on Toga (2 weeks) was removed because the Menu builder was add on the commit beeware/toga@9d9c911. The weeks remaining from this section removal was migrate to Advance General Widgets subsection.

Cricket should support testing on tox

tox is heavily used in many major projects for the ease of testing multiple Python configurations, versions of packages, and the like. Cricket should support using tox, because then it's usefulness is amplified in projects that use tox, as it can put a nice face on running lots of different tests on different tox envs from one spot.

Things that need to be taken into consideration:

  • Test discovery will have to be per-environment. Test suites do not stay the same on 2.6, 2.7, 3.3, etc, especially in the case of Twisted. We have entire test files that are not on 3.3, some test classes are deleted because they can't be run, and therefore won't show up on test discovery for all platforms. We also generate some test classes depending on what reactors are available, and not all Pythons have the same reactors available. Therefore, during startup, a "discovery" run will have to happen, possibly in a env called something like "py27-tests-discovery" for the "py27-tests" env, which just executes the test runner in a "dry run" configuration (-n for Twisted Trial).
  • Cricket can't just access the raw unittest results -- it'll have to use something like subunit, which is a machine-readable streaming output format. Trial has built-in support for subunit, and there is a py.test plugin available for it. So, cricket will have to understand this subunit output, but that shouldn't be too difficult.
  • Cricket will have to execute tox itself, and have some way of knowing when the tests start and what's tox's output. Tox has --result-json but I have no idea if it is streaming (unlikely). Running tests in parallel environments may be desirable, but it may also not be.

Cricket doesn't run in a brew virtual env under OSX

After launching, it displays the error:

/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named cricket.unittest

Which isn't where it should be looking, because:

dougs-Mac-mini:chirp doug$ which cricket-unittest
/Users/doug/projects/games/chirp/py/bin/cricket-unittest

Looks like this is because the unit test module naively uses:

from cricket.model import Project

class UnittestProject(Project):

    def discover_commandline(self):
        "Command line: Discover all available tests in a project."
        return ['python', '-m', 'cricket.unittest.discoverer']

    def execute_commandline(self, labels):
        "Return the command line to execute the specified test labels"
        return ['python', '-m', 'cricket.unittest.executor'] + labels

When it's not certain that 'python' is the current python; perhaps this can be changed to sys.executable, to support 1) windows, and 2) virtualenv's that haven't been activated.

Cricket does not work with Python 3.6

Cricket does not work when using Python 3.6. Tracking down the issue, there is an import error in the (unmaintained?) tkreadonly library, which is still used as dependency by the (still maintained) cricket application.

The fix for tkreadonly that makes it work with Python 3.6 and earlier is here:
pybee/tkreadonly#2

Suggestion: make tree collapsed at start

I'm not sure if there may be a compelling reason to not do this, but it might be useful to have the tree collapsed when cricket starts. If I am trying to navigate to a single suite or test, this would let me do less scrolling/collapsing.

Console exception when pressing cancel on the test discovery fail dialog

Issue #5 reported a problem with the test discovery error dialog: if you had a problem with your test suite, you would get stuck in a continuous loop of dialogs being shown with no way to exit.

The solution for that bug was to add a cancel button to escape the loop. However, if you get the dialog on first startup and hit cancel, an exception is raised at the shell prompt. This isn't inherently a problem, but it is a bit messy.

AttributeError: 'module' object has no attribute 'result'.

This error occurs when I attempt to run main.py in the unittest folder. There doesn't seem to be any result module in the unittest folder, so I'm not sure why PipedTestResult is using this unknown module.

NOTE: Running on Python 2.7.13 on Windows 7

Traceback (most recent call last):
File "C:/../cricket-master/cricket/unittest/main.py", line 4, in
from cricket.main import main as cricket_main
File "C:..\cricket-master\cricket\main.py", line 15, in
from cricket.view import (
File "C:..\cricket-master\cricket\view.py", line 32, in
from cricket.executor import Executor
File "C:\Users..\cricket-master\cricket\executor.py", line 13, in
from cricket.pipes import PipedTestResult, PipedTestRunner
File "C:..\cricket-master\cricket\pipes.py", line 47, in
class PipedTestResult(unittest.result.TestResult):
AttributeError: 'module' object has no attribute 'result'

Displaying images in gui

I have poked around a little in the views.py. I worked out how to add a new tab that allows users to select which browswer they would like the tests to run in. I couldn't figure out how to get an image to display in the gui, however. If you could point me in the right direction, i would appreciate it. Btw, i'm not sure if this is the right place to post this because this isn't a bug.

subprocess Runtime warning: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used

Describe the bug
Running "Run selected" on a top-level item, causes "Test output ended unexpectedly" in cricket with the following message in the console.

/usr/lib/python3.8/subprocess.py:844: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
  self.stdout = io.open(c2pread, 'rb', bufsize)
/usr/lib/python3.8/subprocess.py:849: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
  self.stderr = io.open(errread, 'rb', bufsize)

(This does not happen, when I "Run all")

To Reproduce

  1. Create a test project
  2. Open cricket
  3. Select test "folder"
  4. Click "Run selected"
  5.  
    • EXPECTED: Tests run and their output is shown.
    • ACTUAL: Test results are not shown (I can't tell if tests were run)

Misc

  • Everything works fine when I use "Run all"
  • Everything works fine, when I "Run selected" on a "python file"
  • Behaviour started after upgrading packages via pip
  • I tried reinstalling cricket: no change

Screenshots
image

Environment:

  • Operating System: XUbuntu 20.10
  • Python version: 3.8.6

Add support for Python3, please.

$ cricket-django 
Traceback (most recent call last):
  File "/home/nikola/proj/venv/bin/cricket-django", line 9, in <module>
    load_entry_point('cricket==0.2.3', 'console_scripts', 'cricket-django')()
  File "/home/nikola/proj/venv/lib/python3.4/site-packages/pkg_resources.py", line 353, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/nikola/proj/venv/lib/python3.4/site-packages/pkg_resources.py", line 2302, in load_entry_point
    return ep.load()
  File "/home/nikola/proj/venv/lib/python3.4/site-packages/pkg_resources.py", line 2029, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/home/nikola/proj/venv/lib/python3.4/site-packages/cricket/django/__main__.py", line 4, in <module>
    from cricket.main import main as cricket_main
  File "/home/nikola/proj/venv/lib/python3.4/site-packages/cricket/main.py", line 36
    print cricket.VERSION
                ^
SyntaxError: invalid syntax

Issue when installing on python3.5

(zproc-eGzboTzC) ~/P/zproc ) python --version
Python 3.5.0
(zproc-eGzboTzC) ~/P/zproc ) pip install cricket==0.3.0.dev1
Collecting cricket==0.3.0.dev1
  Downloading https://files.pythonhosted.org/packages/37/75/8d91c1c08e107c2862a75e32ff6f381d208a6c76d2027528c792a50151ca/cricket-0.3.0.dev1-py2.py3-none-any.whl (597kB)
    100% |████████████████████████████████| 604kB 471kB/s 
Requirement already satisfied: setuptools>=39.1.0 in /home/dev/.local/share/virtualenvs/zproc-eGzboTzC/lib/python3.5/site-packages (from cricket==0.3.0.dev1) (40.0.0)
Collecting toga==0.3.0.dev9 (from cricket==0.3.0.dev1)
  Downloading https://files.pythonhosted.org/packages/d9/7e/8dbbc6c9231ee456a37b6ae814755c7a58101fd5e90056822ea9306f50dd/toga-0.3.0.dev9-py3-none-any.whl
Collecting toga-gtk==0.3.0.dev9; sys_platform == "linux" (from toga==0.3.0.dev9->cricket==0.3.0.dev1)
  Downloading https://files.pythonhosted.org/packages/de/2f/b1db7bf869c3c69af1658e4fd676cf19fd8fd1fef12ccdfaaffaff0d1890/toga_gtk-0.3.0.dev9-py3-none-any.whl
Collecting pygobject>=3.14.0 (from toga-gtk==0.3.0.dev9; sys_platform == "linux"->toga==0.3.0.dev9->cricket==0.3.0.dev1)
  Downloading https://files.pythonhosted.org/packages/00/17/198a9d0eb0e89b5c7d2a9b4437eb40d62702ab771030cd79fc7141cb0d30/PyGObject-3.30.1.tar.gz (711kB)
    100% |████████████████████████████████| 716kB 391kB/s 
Collecting gbulb>=0.5.3 (from toga-gtk==0.3.0.dev9; sys_platform == "linux"->toga==0.3.0.dev9->cricket==0.3.0.dev1)
  Downloading https://files.pythonhosted.org/packages/92/cb/d2a0e4899cde5aa797e31d77a0a7422dcd188d880bb38d0e9d1b1196e5c6/gbulb-0.6.1.tar.gz
gbulb requires Python '>3.5' but the running Python is 3.5.0

Correct test failures

The current development branch has some tests from the old 0.2 branch that are failing because the port to Toga required some changes in APIs. These tests need to be updated for the new 0.3 APIs.

Re-run with no failed tests gets confused about progress (and more)

The progress bar falls about laughing in the face of a "Re-Run" when there were no failed tests. This is because it believes the number of tests to run are what project.find_tests returns as a count, but that will return 0 if there were no failed tests. It also returns no labels to restrict the test run to so the executor will run all tests.

Either Re-Run needs to be disabled in the face of no failures, or the above count issue needs to be addressed. I'd suggest disabling the button and re-labelling it "Re-Run Failures".

Similarly the "Run Selected" button should be disabled if there are no selected tests.

I'm also looking to add a binding for to (re-)run tests which will execute tests as though the user pressed the "Re-Run", or "Run Selected", or "Run All" button depending on the current state of the runner (ie. whether there are any failed tests, or any selected tests otherwise all tests.) It would highlight the active button in some way.

failure on pre test setup in a Django test case behaves unexpectedly

Using crickets test runner any output going to stdout in Django's TestCase pre setup will result in the following error. This could occur when an exception (for example ImproperlyConfigured) in pre setup is raised due to an error in a settings.py file

py manage.py test main.SimpleTest --testrunner=cricket.django.runners.TestExecutor

outputs:

AttributeError: 'PipedTestResult' object has no attribute '_stdout'

The same test using the standard Django test runner outputs the error to stdout as expected.

python manage.py test main.SimpleTest

outputs:
ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

Tests not populated in tree view - Windows 7

I installed cricket 0.3.0. OS is windows 7.
I run cricket-pytest from a directory with multiple test files. The cricket window pops up but no tests are populated in the tree view. It is empty.

Below are errors from the command prompt.
image

image

Missing cricket-pytest

According to the README, I should be able to do:

$ pip install cricket
$ cricket-pytest

however that doesn't work :-( Seems like it only installs the cricket-django and cricket-unittest commands.
Is this because the version on PyPI is so old? (PyPI says it was last updated in June 2016) If so, consider this a request for an updated PyPI release 😉

Unable to open "File" menu

Here is the steps:

  1. Window 10 (64 bit) + Pycharm + Python 3.7.1 + unittest project
  2. Not running Cricket in a virtualenv
  3. CMD: C:\test cases directory>cricket-unittest
  4. Cricket opened, the test cases were loaded; But when click the "File" menu, it didn't response

Is there any suggestion or solution?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.