Giter VIP home page Giter VIP logo

Comments (6)

laurensvdwiel avatar laurensvdwiel commented on July 24, 2024

Fixed per 97f2b35

from metadome.

laurensvdwiel avatar laurensvdwiel commented on July 24, 2024

Added tests in: 15c768a

from metadome.

cbaakman avatar cbaakman commented on July 24, 2024

When executing the two unit tests at my local machine, I get the following errors:

======================================================================
ERROR: test_three_letter_amino_acid_residue_pyrrolysine (tests.unit.domain.models.entities.test_codon.Test_codon)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/ext/declarative/clsregistry.py", line 281, in __call__
    x = eval(self.arg, globals(), self._dict)
  File "<string>", line 1, in <module>
NameError: name 'Protein' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/app/tests/unit/domain/models/entities/test_codon.py", line 26, in test_three_letter_amino_acid_residue_pyrrolysine
    _mappings.append(Mapping(base_pair='T', codon='TAG', codon_base_pair_position=0, amino_acid_residue='U', cDNA_position=1, chromosome_position=1))
  File "<string>", line 2, in __init__
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/orm/instrumentation.py", line 347, in _new_state_if_none
    state = self._state_constructor(instance, self)
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/util/langhelpers.py", line 767, in __get__
    obj.__dict__[self.__name__] = result = self.fget(obj)
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/orm/instrumentation.py", line 177, in _state_constructor
    self.dispatch.first_init(self, self.class_)
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/event/attr.py", line 256, in __call__
    fn(*args, **kw)
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/orm/mapper.py", line 2983, in _event_on_first_init
    configure_mappers()
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/orm/mapper.py", line 2873, in configure_mappers
    mapper._post_configure_properties()
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/orm/mapper.py", line 1766, in _post_configure_properties
    prop.init()
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/orm/interfaces.py", line 184, in init
    self.do_init()
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/orm/relationships.py", line 1653, in do_init
    self._process_dependent_arguments()
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/orm/relationships.py", line 1710, in _process_dependent_arguments
    self.target = self.mapper.mapped_table
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/util/langhelpers.py", line 767, in __get__
    obj.__dict__[self.__name__] = result = self.fget(obj)
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/orm/relationships.py", line 1626, in mapper
    argument = self.argument()
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/ext/declarative/clsregistry.py", line 293, in __call__
    (self.prop.parent, self.arg, n.args[0], self.cls)
sqlalchemy.exc.InvalidRequestError: When initializing mapper Mapper|Mapping|mappings, expression 'Protein' failed to locate a name ("name 'Protein' is not defined"). If this is a class name, consider adding this relationship() to the <class 'metadome.domain.models.mapping.Mapping'> class after both dependent classes have been defined.

======================================================================
ERROR: test_three_letter_amino_acid_residue_selenocysteine (tests.unit.domain.models.entities.test_codon.Test_codon)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/src/app/tests/unit/domain/models/entities/test_codon.py", line 15, in test_three_letter_amino_acid_residue_selenocysteine
    _mappings.append(Mapping(base_pair='T', codon='TGA', codon_base_pair_position=0, amino_acid_residue='U', cDNA_position=1, chromosome_position=1))
  File "<string>", line 2, in __init__
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/orm/instrumentation.py", line 347, in _new_state_if_none
    state = self._state_constructor(instance, self)
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/util/langhelpers.py", line 767, in __get__
    obj.__dict__[self.__name__] = result = self.fget(obj)
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/orm/instrumentation.py", line 177, in _state_constructor
    self.dispatch.first_init(self, self.class_)
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/event/attr.py", line 256, in __call__
    fn(*args, **kw)
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/orm/mapper.py", line 2983, in _event_on_first_init
    configure_mappers()
  File "/usr/local/lib/python3.5/site-packages/sqlalchemy/orm/mapper.py", line 2870, in configure_mappers
    raise e
sqlalchemy.exc.InvalidRequestError: One or more mappers failed to initialize - can't proceed with initialization of other mappers. Triggering mapper: 'Mapper|Mapping|mappings'. Original exception was: When initializing mapper Mapper|Mapping|mappings, expression 'Protein' failed to locate a name ("name 'Protein' is not defined"). If this is a class name, consider adding this relationship() to the <class 'metadome.domain.models.mapping.Mapping'> class after both dependent classes have been defined.

@laurensvdwiel Is this due to missing databanks?

Unit tests should not be dependent on databanks. They should run on objects generated in the test.

from metadome.

laurensvdwiel avatar laurensvdwiel commented on July 24, 2024

I have no idea why this is an error, it worked on my test setup. How are you running the tests?

from metadome.

cbaakman avatar cbaakman commented on July 24, 2024

Like this:

./run_tests.sh -t tests/unit/domain/models/entities/test_codon.py

Alias:

docker-compose -f docker-compose.yml -f docker-compose-dev.yml run --no-deps --rm celery nosetests -v -a !disabled --with-coverage --cover-inclusive --cover-package metadome tests/unit/domain/models/entities/test_codon.py

from metadome.

laurensvdwiel avatar laurensvdwiel commented on July 24, 2024

fixed per cc71773

from metadome.

Related Issues (20)

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.