Adapted tests to the new drill_marks validation

- Also removed the setter helper, no longer needed as validation is
  done by Optionable
This commit is contained in:
Salvador E. Tropea 2022-06-10 08:47:58 -03:00
parent 2ec1d9da1b
commit 0583befe6a
4 changed files with 6 additions and 20 deletions

View File

@ -4,7 +4,6 @@
# License: GPL-3.0
# Project: KiBot (formerly KiPlot)
from pcbnew import PCB_PLOT_PARAMS
from .error import KiPlotConfigurationError
from .out_any_layer import AnyLayerOptions
from . import log
@ -25,12 +24,6 @@ DRILL_MARKS_REV_MAP = {
DRILL_MARKS_HELP = "[none,small,full] What to use to indicate the drill places, can be none, small or full (for real scale)"
def drill_marks_setter(val):
if val not in DRILL_MARKS_MAP:
raise KiPlotConfigurationError("Unknown drill mark type: {}".format(val))
return val
def drill_marks_help(self):
self._drill_marks = 'full'
self.set_doc('drill_marks', " [string='full'] "+DRILL_MARKS_HELP)
@ -49,7 +42,7 @@ class DrillMarks(AnyLayerOptions):
@drill_marks.setter
def drill_marks(self, val):
self._drill_marks = drill_marks_setter(val)
self._drill_marks = val
def config(self, parent):
super().config(parent)

View File

@ -12,7 +12,7 @@ from .misc import CMD_PCBNEW_PRINT_LAYERS, URL_PCBNEW_PRINT_LAYERS, PDF_PCB_PRIN
from .out_base import VariantOptions
from .registrable import RegDependency
from .macros import macros, document, output_class # noqa: F401
from .drill_marks import drill_marks_help, drill_marks_setter, DRILL_MARKS_MAP
from .drill_marks import drill_marks_help, DRILL_MARKS_MAP
from .layer import Layer
from . import log
@ -60,7 +60,7 @@ class Any_PCB_PrintOptions(VariantOptions):
@drill_marks.setter
def drill_marks(self, val):
self._drill_marks = drill_marks_setter(val)
self._drill_marks = val
def config(self, parent):
super().config(parent)

View File

@ -28,7 +28,7 @@ from .kiplot import check_script, exec_with_retry, add_extra_options
from .registrable import RegDependency
from .create_pdf import create_pdf_from_pages
from .macros import macros, document, output_class # noqa: F401
from .drill_marks import DRILL_MARKS_MAP, drill_marks_setter, drill_marks_help
from .drill_marks import DRILL_MARKS_MAP, drill_marks_help
from .layer import Layer, get_priority
from . import __version__
from . import log
@ -303,7 +303,7 @@ class PCB_PrintOptions(VariantOptions):
@drill_marks.setter
def drill_marks(self, val):
self._drill_marks = drill_marks_setter(val)
self._drill_marks = val
def config(self, parent):
super().config(parent)

View File

@ -449,14 +449,7 @@ def test_error_gerber_precision(test_dir):
def test_error_wrong_drill_marks_1(test_dir):
ctx = context.TestContext(test_dir, 'test_error_wrong_drill_marks_1', PRJ, 'error_wrong_drill_marks', '')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Unknown drill mark type: bogus")
ctx.clean_up()
def test_error_wrong_drill_marks_2(test_dir):
ctx = context.TestContext(test_dir, 'test_error_wrong_drill_marks_2', PRJ, 'error_wrong_drill_marks_2', '')
ctx.run(EXIT_BAD_CONFIG)
assert ctx.search_err("Unknown drill mark type: bogus")
assert ctx.search_err(r"Option `drill_marks` must be any of \['none', 'small', 'full'\] not `bogus`")
ctx.clean_up()