diff --git a/CHANGES.rst b/CHANGES.rst index 91fe8d9..bda2020 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,7 @@ Changelog 1.0.0 (unreleased) ------------------ +- #10 Fix failing tests - #8 Fix nexion350x Instrument by not lowering keywords - #7 Fix Winlab Instrument by not lowering keywords - First version of `senaite.instruments` diff --git a/src/senaite/instruments/docs/INSTRUMENTS.rst b/src/senaite/instruments/docs/INSTRUMENTS.rst index 04911f4..0881eb5 100644 --- a/src/senaite/instruments/docs/INSTRUMENTS.rst +++ b/src/senaite/instruments/docs/INSTRUMENTS.rst @@ -41,10 +41,11 @@ Variables:: >>> portal = self.portal >>> request = self.request >>> bika_setup = portal.bika_setup + >>> setup = portal.setup >>> bika_instruments = bika_setup.bika_instruments >>> bika_sampletypes = bika_setup.bika_sampletypes - >>> bika_samplepoints = bika_setup.bika_samplepoints - >>> bika_analysiscategories = bika_setup.bika_analysiscategories + >>> bika_samplepoints = setup.samplepoints + >>> bika_analysiscategories = setup.analysiscategories >>> bika_analysisservices = bika_setup.bika_analysisservices >>> bika_calculations = bika_setup.bika_calculations >>> bika_methods = portal.methods @@ -116,7 +117,7 @@ This service matches the service specified in the file from which the import wil >>> analysiscategory = api.create(bika_analysiscategories, "AnalysisCategory", title="Water") >>> analysiscategory - + >>> analysisservice1 = api.create(bika_analysisservices, ... "AnalysisService", ... title="HIV06ml", diff --git a/src/senaite/instruments/instruments/agilent/chemstation/chemstation.py b/src/senaite/instruments/instruments/agilent/chemstation/chemstation.py index b22afaa..adfc1fb 100644 --- a/src/senaite/instruments/instruments/agilent/chemstation/chemstation.py +++ b/src/senaite/instruments/instruments/agilent/chemstation/chemstation.py @@ -8,7 +8,7 @@ from senaite.core.exportimport.instruments import IInstrumentAutoImportInterface from senaite.core.exportimport.instruments import IInstrumentExportInterface from senaite.core.exportimport.instruments import IInstrumentImportInterface -from senaite.core.exportimport.instruments.instrument import format_keyword +from senaite.core.exportimport.instruments.utils import format_keyword from senaite.core.exportimport.instruments.resultsimport import AnalysisResultsImporter from bika.lims.utils import t from cStringIO import StringIO @@ -234,7 +234,7 @@ def Import(self, context, request): importer = AnalysisResultsImporter( parser=parser, context=context, - allowed_ar_states=status, + allowed_sample_states=status, allowed_analysis_states=None, override=over, instrument_uid=instrument) diff --git a/src/senaite/instruments/instruments/agilent/masshunter/aorc.py b/src/senaite/instruments/instruments/agilent/masshunter/aorc.py index dc4d73d..abec757 100644 --- a/src/senaite/instruments/instruments/agilent/masshunter/aorc.py +++ b/src/senaite/instruments/instruments/agilent/masshunter/aorc.py @@ -6,7 +6,7 @@ from bika.lims import bikaMessageFactory as _ from senaite.core.exportimport.instruments import IInstrumentAutoImportInterface from senaite.core.exportimport.instruments import IInstrumentImportInterface -from senaite.core.exportimport.instruments.instrument import format_keyword +from senaite.core.exportimport.instruments.utils import format_keyword from senaite.core.exportimport.instruments.resultsimport import AnalysisResultsImporter from bika.lims.utils import t from DateTime import DateTime @@ -168,7 +168,7 @@ def Import(self, context, request): importer = AnalysisResultsImporter( parser=parser, context=context, - allowed_ar_states=status, + allowed_sample_states=status, allowed_analysis_states=None, override=over, instrument_uid=instrument) diff --git a/src/senaite/instruments/instruments/agilent/masshunter/qualitative.py b/src/senaite/instruments/instruments/agilent/masshunter/qualitative.py index 9512cd9..60d937c 100644 --- a/src/senaite/instruments/instruments/agilent/masshunter/qualitative.py +++ b/src/senaite/instruments/instruments/agilent/masshunter/qualitative.py @@ -8,7 +8,7 @@ from senaite.core.exportimport.instruments import IInstrumentAutoImportInterface from senaite.core.exportimport.instruments import IInstrumentExportInterface from senaite.core.exportimport.instruments import IInstrumentImportInterface -from senaite.core.exportimport.instruments.instrument import format_keyword +from senaite.core.exportimport.instruments.utils import format_keyword from senaite.core.exportimport.instruments.resultsimport import AnalysisResultsImporter from senaite.core.exportimport.instruments.resultsimport import InstrumentCSVResultsFileParser from bika.lims.utils import t @@ -167,7 +167,7 @@ def Import(self, context, request): importer = QualitativeImporter( parser=parser, context=context, - allowed_ar_states=status, + allowed_sample_states=status, allowed_analysis_states=None, override=over, instrument_uid=instrument) diff --git a/src/senaite/instruments/instruments/agilent/masshunter/quantitative.py b/src/senaite/instruments/instruments/agilent/masshunter/quantitative.py index c4bb7a2..1ce50f3 100644 --- a/src/senaite/instruments/instruments/agilent/masshunter/quantitative.py +++ b/src/senaite/instruments/instruments/agilent/masshunter/quantitative.py @@ -8,7 +8,7 @@ from senaite.core.exportimport.instruments import IInstrumentAutoImportInterface from senaite.core.exportimport.instruments import IInstrumentExportInterface from senaite.core.exportimport.instruments import IInstrumentImportInterface -from senaite.core.exportimport.instruments.instrument import format_keyword +from senaite.core.exportimport.instruments.utils import format_keyword from senaite.core.exportimport.instruments.resultsimport import AnalysisResultsImporter from senaite.core.exportimport.instruments.resultsimport import InstrumentCSVResultsFileParser from bika.lims.utils import t @@ -188,7 +188,7 @@ def Import(self, context, request): importer = QuantitativeImporter( parser=parser, context=context, - allowed_ar_states=status, + allowed_sample_states=status, allowed_analysis_states=None, override=over, instrument_uid=instrument) diff --git a/src/senaite/instruments/instruments/bruker/s8tiger/s8tiger.py b/src/senaite/instruments/instruments/bruker/s8tiger/s8tiger.py index faa402d..ee2def0 100644 --- a/src/senaite/instruments/instruments/bruker/s8tiger/s8tiger.py +++ b/src/senaite/instruments/instruments/bruker/s8tiger/s8tiger.py @@ -137,13 +137,15 @@ def parse(self): reader = csv.DictReader(lines) for row in reader: self.parse_row(ar, reader.line_num, row) - return 0 + return True def parse_row(self, ar, row_nr, row): + # commented out the the next 4 lines out becuase reading is not in + # field_interim_map in 47 where it is defined # convert row to use interim field names - if 'reading' not in field_interim_map.values(): - self.err("Missing 'reading' interim field.") - return -1 + # if 'reading' not in field_interim_map.values(): + # self.err("Missing 'reading' interim field.") + # return -1 parsed = {field_interim_map.get(k, ''): v for k, v in row.items()} formula = parsed.get('formula') @@ -266,7 +268,7 @@ def Import(context, request): importer = AnalysisResultsImporter( parser=parser, context=context, - allowed_ar_states=status, + allowed_sample_states=status, allowed_analysis_states=None, override=over, instrument_uid=instrument) diff --git a/src/senaite/instruments/instruments/perkinelmer/nexion350x/nexion350x.py b/src/senaite/instruments/instruments/perkinelmer/nexion350x/nexion350x.py index 52d17e7..f1558ea 100644 --- a/src/senaite/instruments/instruments/perkinelmer/nexion350x/nexion350x.py +++ b/src/senaite/instruments/instruments/perkinelmer/nexion350x/nexion350x.py @@ -105,7 +105,7 @@ def parse(self): reader = csv.DictReader(lines) for row in reader: self.parse_row(reader.line_num, row) - return 0 + return True def parse_row(self, row_nr, row): if row['Sample Id'].lower().strip() in ( @@ -210,7 +210,7 @@ def Import(context, request): importer = AnalysisResultsImporter( parser=parser, context=context, - allowed_ar_states=status, + allowed_sample_states=status, allowed_analysis_states=None, override=over, instrument_uid=instrument) diff --git a/src/senaite/instruments/instruments/perkinelmer/winlab32/winlab32.py b/src/senaite/instruments/instruments/perkinelmer/winlab32/winlab32.py index 89b171d..764ba99 100644 --- a/src/senaite/instruments/instruments/perkinelmer/winlab32/winlab32.py +++ b/src/senaite/instruments/instruments/perkinelmer/winlab32/winlab32.py @@ -96,7 +96,7 @@ def parse(self): reader = csv.DictReader(lines) for row in reader: self.parse_row(reader.line_num, row) - return 0 + return True def parse_row(self, row_nr, row): # convert row to use interim field names @@ -196,7 +196,7 @@ def Import(context, request): importer = AnalysisResultsImporter( parser=parser, context=context, - allowed_ar_states=status, + allowed_sample_states=status, allowed_analysis_states=None, override=over, instrument_uid=instrument) diff --git a/src/senaite/instruments/tests/base.py b/src/senaite/instruments/tests/base.py index 9e7606e..f284109 100644 --- a/src/senaite/instruments/tests/base.py +++ b/src/senaite/instruments/tests/base.py @@ -4,7 +4,6 @@ # # Copyright 2018 by it's authors. -from datetime import datetime import unittest2 as unittest from plone.app.testing import FunctionalTesting @@ -21,8 +20,6 @@ from Products.Archetypes.event import ObjectInitializedEvent from Products.CMFPlone.utils import _createObjectByType -from bika.lims import SETUP_CATALOG -from bika.lims import api from bika.lims.idserver import renameAfterCreation from bika.lims.utils import tmpID from bika.lims.utils.analysisrequest import create_analysisrequest @@ -138,29 +135,23 @@ def add_contact(self, folder, **kwargs): return obj def add_manufacturer(self, **kwargs): - folder = self.portal.bika_setup.bika_manufacturers + folder = self.portal.setup.manufacturers obj = _createObjectByType('Manufacturer', folder, tmpID()) obj.edit(**kwargs) - obj.unmarkCreationFlag() - renameAfterCreation(obj) notify(ObjectInitializedEvent(obj)) return obj def add_supplier(self, **kwargs): - folder = self.portal.bika_setup.bika_suppliers + folder = self.portal.setup.suppliers obj = _createObjectByType('Supplier', folder, tmpID()) obj.edit(**kwargs) - obj.unmarkCreationFlag() - renameAfterCreation(obj) notify(ObjectInitializedEvent(obj)) return obj def add_instrumenttype(self, **kwargs): - folder = self.portal.bika_setup.bika_instrumenttypes + folder = self.portal.setup.instrumenttypes obj = _createObjectByType('InstrumentType', folder, tmpID()) obj.edit(**kwargs) - obj.unmarkCreationFlag() - renameAfterCreation(obj) notify(ObjectInitializedEvent(obj)) return obj @@ -174,11 +165,9 @@ def add_instrument(self, **kwargs): return obj def add_analysiscategory(self, **kwargs): - folder = self.portal.bika_setup.bika_analysiscategories + folder = self.portal.setup.analysiscategories obj = _createObjectByType('AnalysisCategory', folder, tmpID()) obj.edit(**kwargs) - obj.unmarkCreationFlag() - renameAfterCreation(obj) notify(ObjectInitializedEvent(obj)) return obj