- I've finally run the tests with OK result (56 tests in 102.937 sec)

- I had to play with module imports as they created a lot of error in
the tests although in reality the program worked OK.
- I've fixed some mistakes in TcL commands (they were testing isinstance
against the like of Geometry instead of FlatCAMGeometry)
- I've had to add some fixes in ObjectCollections.py (error on
create_index() method but Marco already fixed this in the checkbox
in project tab pull request and knew about this.
- Although at some point the tests run fine, I've made some checkings
on my own over the Tcl commands and discovered errors which I fixed as
mentioned above.
- conclusion is that tests are just a must and do not cover everything
(like saving projects which at some point by juggling with imports I
braked and tests were 100% OK)
This commit is contained in:
Marius Stanciu
2018-05-30 02:17:34 +03:00
parent da9f890c39
commit 3b9767cc6f
47 changed files with 63 additions and 105 deletions

View File

@@ -5,6 +5,7 @@ import abc
import collections
from PyQt4 import QtCore
from contextlib import contextmanager
from FlatCAMObj import FlatCAMGerber, FlatCAMExcellon, FlatCAMGeometry, FlatCAMCNCjob, FlatCAMObj
class TclCommand(object):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
from tclCommands.TclCommand import *
class TclCommandAddCircle(TclCommand):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandAddPolygon(TclCommandSignaled):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandAddPolyline(TclCommandSignaled):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandAddRectangle(TclCommandSignaled):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandAlignDrill(TclCommandSignaled):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandAlignDrillGrid(TclCommandSignaled):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandCncjob(TclCommandSignaled):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
from tclCommands.TclCommand import *
class TclCommandCutout(TclCommand):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
from tclCommands.TclCommand import *
class TclCommandDelete(TclCommand):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandDrillcncjob(TclCommandSignaled):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandExportGcode(TclCommandSignaled):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
from tclCommands.TclCommand import *
class TclCommandExportSVG(TclCommand):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandExteriors(TclCommandSignaled):
@@ -54,7 +53,7 @@ class TclCommandExteriors(TclCommandSignaled):
if obj is None:
self.raise_tcl_error("Object not found: %s" % name)
if not isinstance(obj, Geometry):
if not isinstance(obj, FlatCAMGeometry):
self.raise_tcl_error('Expected Geometry, got %s %s.' % (name, type(obj)))
def geo_init(geo_obj, app_obj):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandGeoCutout(TclCommandSignaled):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
from tclCommands.TclCommand import *
class TclCommandGeoUnion(TclCommand):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
from tclCommands.TclCommand import *
class TclCommandGetNames(TclCommand):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
from tclCommands.TclCommand import *
class TclCommandGetSys(TclCommand):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandImportSvg(TclCommandSignaled):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandInteriors(TclCommandSignaled):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandIsolate(TclCommandSignaled):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
from tclCommands.TclCommand import *
class TclCommandJoinExcellon(TclCommand):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
from tclCommands.TclCommand import *
class TclCommandJoinGeometry(TclCommand):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandMillHoles(TclCommandSignaled):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandMirror(TclCommandSignaled):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
from tclCommands.TclCommand import *
class TclCommandNew(TclCommand):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandNewGeometry(TclCommandSignaled):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
from tclCommands.TclCommand import *
class TclCommandOffset(TclCommand):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandOpenExcellon(TclCommandSignaled):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandOpenGCode(TclCommandSignaled):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandOpenGerber(TclCommandSignaled):
@@ -48,7 +47,7 @@ class TclCommandOpenGerber(TclCommandSignaled):
# How the object should be initialized
def obj_init(gerber_obj, app_obj):
if not isinstance(gerber_obj, Geometry):
if not isinstance(gerber_obj, FlatCAMGerber):
self.raise_tcl_error('Expected FlatCAMGerber, got %s %s.' % (outname, type(gerber_obj)))
# Opening the file happens here

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandOpenProject(TclCommandSignaled):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandOptions(TclCommandSignaled):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandPaint(TclCommandSignaled):

View File

@@ -1,7 +1,5 @@
from ObjectCollection import *
from copy import copy,deepcopy
from tclCommands.TclCommand import TclCommand
from tclCommands.TclCommand import *
class TclCommandPanelize(TclCommand):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
from tclCommands.TclCommand import *
class TclCommandPlot(TclCommand):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandSaveProject(TclCommandSignaled):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
from tclCommands.TclCommand import *
class TclCommandScale(TclCommand):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
from tclCommands.TclCommand import *
class TclCommandSetActive(TclCommand):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
from tclCommands.TclCommand import *
class TclCommandSetSys(TclCommand):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandSubtractPoly(TclCommandSignaled):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandSubtractRectangle(TclCommandSignaled):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommand
from tclCommands.TclCommand import *
class TclCommandVersion(TclCommand):

View File

@@ -1,5 +1,4 @@
from ObjectCollection import *
from tclCommands.TclCommand import TclCommandSignaled
from tclCommands.TclCommand import *
class TclCommandWriteGCode(TclCommandSignaled):