cmbi / kmad-web

1 stars 1 forks source link

tests failing #28

Open cbaakman opened 7 years ago

cbaakman commented 7 years ago

The following tests are failing:

unit.test_sequences_annotator.test_annotate unit.test_fles.test_make_fles unit.test_go_provider.test_get_children_terms unit.test_go_provider.test_get_parent_terms unit.test_go_service.test_call integration.test_elm_update.TestTasks.test_elm_update

joannalange commented 7 years ago

@cbaakman what output do you get for integration.test_elm_update.TestTasks.test_elm_update?

cbaakman commented 7 years ago

This output:

docker-compose -f docker-compose.yml -f docker-compose-dev.yml run --rm celery nosetests -v -a !disabled --with-coverage --cover-inclusive --cover-package hope tests/integration/test_elm_update.py:TestTasks.test_elm_update
Creating kmadweb_redis_1
Creating kmadweb_rabbitmq_1
test_elm_update.TestTasks.test_elm_update ... ERROR

======================================================================
ERROR: test_elm_update.TestTasks.test_elm_update
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/usr/src/app/tests/integration/test_elm_update.py", line 23, in test_elm_update
    update_elmdb()
  File "/usr/local/lib/python2.7/dist-packages/celery/local.py", line 188, in __call__
    return self._get_current_object()(*a, **kw)
  File "/usr/src/app/kmad_web/factory.py", line 115, in __call__
    return TaskBase.__call__(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/celery/app/task.py", line 420, in __call__
    return self.run(*args, **kwargs)
  File "/usr/src/app/kmad_web/tasks.py", line 328, in update_elmdb
    elm.update()
  File "/usr/src/app/kmad_web/domain/updaters/elm.py", line 32, in update
    extended_go_terms = self._get_extended_go_terms(motif_id)
  File "/usr/src/app/kmad_web/domain/updaters/elm.py", line 58, in _get_extended_go_terms
    go.get_parent_terms(go_term)
  File "/usr/src/app/kmad_web/domain/go/providers/go.py", line 21, in get_parent_terms
    response = dict(go.call(method, go_term, "GO"))
  File "/usr/src/app/kmad_web/services/helpers/cache.py", line 40, in new_f
    return region_decorator(f)(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/dogpile/cache/region.py", line 1053, in decorate
    should_cache_fn)
  File "/usr/local/lib/python2.7/dist-packages/dogpile/cache/region.py", line 657, in get_or_create
    async_creator) as value:
  File "/usr/local/lib/python2.7/dist-packages/dogpile/core/dogpile.py", line 158, in __enter__
    return self._enter()
  File "/usr/local/lib/python2.7/dist-packages/dogpile/core/dogpile.py", line 98, in _enter
    generated = self._enter_create(createdtime)
  File "/usr/local/lib/python2.7/dist-packages/dogpile/core/dogpile.py", line 149, in _enter_create
    created = self.creator()
  File "/usr/local/lib/python2.7/dist-packages/dogpile/cache/region.py", line 625, in gen_value
    created_value = creator()
  File "/usr/local/lib/python2.7/dist-packages/dogpile/cache/region.py", line 1049, in creator
    return fn(*arg, **kw)
  File "/usr/src/app/kmad_web/services/go.py", line 32, in call
    return soap.run(self._url, soap_timeout, method, *args)
  File "/usr/src/app/kmad_web/services/helpers/soap.py", line 36, in run
    client = Client(url, faults=True, timeout=timeout)
  File "/usr/local/lib/python2.7/dist-packages/suds/client.py", line 112, in __init__
    self.wsdl = reader.open(url)
  File "/usr/local/lib/python2.7/dist-packages/suds/reader.py", line 152, in open
    d = self.fn(url, self.options)
  File "/usr/local/lib/python2.7/dist-packages/suds/wsdl.py", line 136, in __init__
    d = reader.open(url)
  File "/usr/local/lib/python2.7/dist-packages/suds/reader.py", line 79, in open
    d = self.download(url)
  File "/usr/local/lib/python2.7/dist-packages/suds/reader.py", line 95, in download
    fp = self.options.transport.open(Request(url))
  File "/usr/local/lib/python2.7/dist-packages/suds/transport/https.py", line 60, in open
    return  HttpTransport.open(self, request)
  File "/usr/local/lib/python2.7/dist-packages/suds/transport/http.py", line 64, in open
    raise TransportError(str(e), e.code, e.fp)
TransportError: HTTP Error 404: Not Found
-------------------- >> begin captured logging << --------------------
kmad_web.factory: INFO: Creating app
kmad_web.factory: INFO: Creating celery app
kmad_web.domain.updaters.elm: INFO: Running ELM update
kmad_web.services.elm: INFO: Getting all motif classes from ELM
requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection (1): elm.eu.org
requests.packages.urllib3.connectionpool: DEBUG: "GET /elms/elms_index.tsv HTTP/1.1" 200 20885
kmad_web.domain.updaters.elm: DEBUG: Getting GO terms for the DEG_SCF_FBW7_1 motif
dogpile.core.dogpile: DEBUG: NeedRegenerationException
dogpile.core.dogpile: DEBUG: no value, waiting for create lock
dogpile.core.dogpile: DEBUG: value creation lock <redis.lock.LuaLock object at 0x7f242148ff50> acquired
dogpile.core.dogpile: DEBUG: Calling creation function
kmad_web.services.elm: DEBUG: Getting GO terms for motif DEG_SCF_FBW7_1
requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection (1): elm.eu.org
requests.packages.urllib3.connectionpool: DEBUG: "GET /elms/DEG_SCF_FBW7_1.html HTTP/1.1" 200 14837
dogpile.core.dogpile: DEBUG: Released creation lock
kmad_web.domain.updaters.elm: DEBUG: go: 0005634
dogpile.core.dogpile: DEBUG: NeedRegenerationException
dogpile.core.dogpile: DEBUG: no value, waiting for create lock
dogpile.core.dogpile: DEBUG: value creation lock <redis.lock.LuaLock object at 0x7f2420bd5650> acquired
dogpile.core.dogpile: DEBUG: Calling creation function
kmad_web.services.go: INFO: Calling go search method 'getTermParents'
dogpile.core.dogpile: DEBUG: Released creation lock
--------------------- >> end captured logging << ---------------------

Coverage.py warning: Module hope was never imported.
Name    Stmts   Miss  Cover   Missing
-------------------------------------
Traceback (most recent call last):
  File "/usr/local/bin/nosetests", line 11, in <module>
    sys.exit(run_exit())
  File "/usr/local/lib/python2.7/dist-packages/nose/core.py", line 121, in __init__
    **extra_args)
  File "/usr/lib/python2.7/unittest/main.py", line 95, in __init__
    self.runTests()
  File "/usr/local/lib/python2.7/dist-packages/nose/core.py", line 207, in runTests
    result = self.testRunner.run(self.test)
  File "/usr/local/lib/python2.7/dist-packages/nose/core.py", line 66, in run
    result.printErrors()
  File "/usr/local/lib/python2.7/dist-packages/nose/result.py", line 110, in printErrors
    self.config.plugins.report(self.stream)
  File "/usr/local/lib/python2.7/dist-packages/nose/plugins/manager.py", line 99, in __call__
    return self.call(*arg, **kw)
  File "/usr/local/lib/python2.7/dist-packages/nose/plugins/manager.py", line 167, in simple
    result = meth(*arg, **kw)
  File "/usr/local/lib/python2.7/dist-packages/nose/plugins/cover.py", line 190, in report
    self.coverInstance.report(modules, file=stream)
  File "/usr/local/lib/python2.7/dist-packages/coverage/control.py", line 966, in report
    return reporter.report(morfs, outfile=file)
  File "/usr/local/lib/python2.7/dist-packages/coverage/summary.py", line 116, in report
    raise CoverageException("No data to report.")
coverage.misc.CoverageException: No data to report.
joannalange commented 7 years ago

Can you flush the redis db, rebuild the docker image and try again?

Also, you're using 'hope' as the cover-package instead of 'kmad-web'

cbaakman commented 7 years ago

OK I just did a pull from the main fork, now the output is:

tests/integration/test_elm_update.py:TestTasks.test_elm_update
docker-compose -f docker-compose.yml -f docker-compose-dev.yml run --rm celery nosetests -v -a !disabled --with-coverage --cover-inclusive --cover-package kmad_web tests/integration/test_elm_update.py:TestTasks.test_elm_update
test_elm_update.TestTasks.test_elm_update ... ERROR

======================================================================
ERROR: test_elm_update.TestTasks.test_elm_update
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/usr/src/app/tests/integration/test_elm_update.py", line 23, in test_elm_update
    update_elmdb()
  File "/usr/local/lib/python2.7/dist-packages/celery/local.py", line 188, in __call__
    return self._get_current_object()(*a, **kw)
  File "/usr/src/app/kmad_web/factory.py", line 115, in __call__
    return TaskBase.__call__(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/celery/app/task.py", line 420, in __call__
    return self.run(*args, **kwargs)
  File "/usr/src/app/kmad_web/tasks.py", line 328, in update_elmdb
    elm.update()
  File "/usr/src/app/kmad_web/domain/updaters/elm.py", line 32, in update
    extended_go_terms = self._get_extended_go_terms(motif_id)
  File "/usr/src/app/kmad_web/domain/updaters/elm.py", line 59, in _get_extended_go_terms
    go.get_children_terms(go_term)
  File "/usr/src/app/kmad_web/domain/go/providers/go.py", line 39, in get_children_terms
    response = go.call(go_term, query)
  File "/usr/src/app/kmad_web/services/helpers/cache.py", line 40, in new_f
    return region_decorator(f)(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/dogpile/cache/region.py", line 1053, in decorate
    should_cache_fn)
  File "/usr/local/lib/python2.7/dist-packages/dogpile/cache/region.py", line 657, in get_or_create
    async_creator) as value:
  File "/usr/local/lib/python2.7/dist-packages/dogpile/core/dogpile.py", line 158, in __enter__
    return self._enter()
  File "/usr/local/lib/python2.7/dist-packages/dogpile/core/dogpile.py", line 98, in _enter
    generated = self._enter_create(createdtime)
  File "/usr/local/lib/python2.7/dist-packages/dogpile/core/dogpile.py", line 149, in _enter_create
    created = self.creator()
  File "/usr/local/lib/python2.7/dist-packages/dogpile/cache/region.py", line 625, in gen_value
    created_value = creator()
  File "/usr/local/lib/python2.7/dist-packages/dogpile/cache/region.py", line 1049, in creator
    return fn(*arg, **kw)
  File "/usr/src/app/kmad_web/services/go.py", line 41, in call
    result = request.json()['_embedded']['terms']
KeyError: '_embedded'
-------------------- >> begin captured logging << --------------------
kmad_web.factory: INFO: Creating app
kmad_web.factory: INFO: Creating celery app
kmad_web.domain.updaters.elm: INFO: Running ELM update
kmad_web.services.elm: INFO: Getting all motif classes from ELM
requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection (1): elm.eu.org
requests.packages.urllib3.connectionpool: DEBUG: "GET /elms/elms_index.tsv HTTP/1.1" 200 20885
kmad_web.domain.updaters.elm: DEBUG: Getting GO terms for the DEG_SCF_FBW7_1 motif
kmad_web.services.elm: DEBUG: Getting GO terms for motif DEG_SCF_FBW7_1
requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection (1): elm.eu.org
requests.packages.urllib3.connectionpool: DEBUG: "GET /elms/DEG_SCF_FBW7_1.html HTTP/1.1" 200 14837
kmad_web.domain.updaters.elm: DEBUG: go: 0005634
dogpile.core.dogpile: DEBUG: NeedRegenerationException
dogpile.core.dogpile: DEBUG: no value, waiting for create lock
dogpile.core.dogpile: DEBUG: value creation lock <redis.lock.LuaLock object at 0x7f79def827d0> acquired
dogpile.core.dogpile: DEBUG: Calling creation function
kmad_web.services.go: INFO: Calling go search method 'parents'
requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection (1): www.ebi.ac.uk
requests.packages.urllib3.connectionpool: DEBUG: "GET /ols/api/ontologies/go/terms/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FGO_0005634/parents HTTP/1.1" 200 None
dogpile.core.dogpile: DEBUG: Released creation lock
dogpile.core.dogpile: DEBUG: NeedRegenerationException
dogpile.core.dogpile: DEBUG: no value, waiting for create lock
dogpile.core.dogpile: DEBUG: value creation lock <redis.lock.LuaLock object at 0x7f79def82810> acquired
dogpile.core.dogpile: DEBUG: Calling creation function
kmad_web.services.go: INFO: Calling go search method 'descendants'
requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection (1): www.ebi.ac.uk
requests.packages.urllib3.connectionpool: DEBUG: "GET /ols/api/ontologies/go/terms/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FGO_0005634/descendants HTTP/1.1" 200 None
dogpile.core.dogpile: DEBUG: Released creation lock
kmad_web.domain.updaters.elm: DEBUG: go parents: set([u'GO:0043231'])
kmad_web.domain.updaters.elm: DEBUG: go children: set([u'GO:0048555', u'GO:0048556', u'GO:1905754', u'GO:0001939', u'GO:0001940', u'GO:0045120', u'GO:0071686', u'GO:0031039', u'GO:0001673', u'GO:0043076', u'GO:0031040', u'GO:0042585', u'GO:0043073', u'GO:0097572', u'GO:0043082', u'GO:0001674', u'GO:0097571', u'GO:0048353', u'GO:0043078', u'GO:0043079'])
kmad_web.domain.updaters.elm: DEBUG: go: 0004842
dogpile.core.dogpile: DEBUG: NeedRegenerationException
dogpile.core.dogpile: DEBUG: no value, waiting for create lock
dogpile.core.dogpile: DEBUG: value creation lock <redis.lock.LuaLock object at 0x7f79df1ba610> acquired
dogpile.core.dogpile: DEBUG: Calling creation function
kmad_web.services.go: INFO: Calling go search method 'parents'
requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection (1): www.ebi.ac.uk
requests.packages.urllib3.connectionpool: DEBUG: "GET /ols/api/ontologies/go/terms/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FGO_0004842/parents HTTP/1.1" 200 None
dogpile.core.dogpile: DEBUG: Released creation lock
dogpile.core.dogpile: DEBUG: NeedRegenerationException
dogpile.core.dogpile: DEBUG: no value, waiting for create lock
dogpile.core.dogpile: DEBUG: value creation lock <redis.lock.LuaLock object at 0x7f79df1ba550> acquired
dogpile.core.dogpile: DEBUG: Calling creation function
kmad_web.services.go: INFO: Calling go search method 'descendants'
requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection (1): www.ebi.ac.uk
requests.packages.urllib3.connectionpool: DEBUG: "GET /ols/api/ontologies/go/terms/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FGO_0004842/descendants HTTP/1.1" 200 None
dogpile.core.dogpile: DEBUG: Released creation lock
kmad_web.domain.updaters.elm: DEBUG: go parents: set([u'GO:0019787'])
kmad_web.domain.updaters.elm: DEBUG: go children: set([u'GO:0034450', u'GO:1904264', u'GO:1904822', u'GO:0050372', u'GO:0061630', u'GO:0061631'])
kmad_web.domain.updaters.elm: DEBUG: go: 0004840
dogpile.core.dogpile: DEBUG: NeedRegenerationException
dogpile.core.dogpile: DEBUG: no value, waiting for create lock
dogpile.core.dogpile: DEBUG: value creation lock <redis.lock.LuaLock object at 0x7f79df1ba190> acquired
dogpile.core.dogpile: DEBUG: Calling creation function
kmad_web.services.go: INFO: Calling go search method 'parents'
requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection (1): www.ebi.ac.uk
requests.packages.urllib3.connectionpool: DEBUG: "GET /ols/api/ontologies/go/terms/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FGO_0004840/parents HTTP/1.1" 200 None
dogpile.core.dogpile: DEBUG: Released creation lock
dogpile.core.dogpile: DEBUG: NeedRegenerationException
dogpile.core.dogpile: DEBUG: no value, waiting for create lock
dogpile.core.dogpile: DEBUG: value creation lock <redis.lock.LuaLock object at 0x7f79df1ba1d0> acquired
dogpile.core.dogpile: DEBUG: Calling creation function
kmad_web.services.go: INFO: Calling go search method 'descendants'
requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection (1): www.ebi.ac.uk
requests.packages.urllib3.connectionpool: DEBUG: "GET /ols/api/ontologies/go/terms/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FGO_0004840/descendants HTTP/1.1" 200 None
dogpile.core.dogpile: DEBUG: Released creation lock
--------------------- >> end captured logging << ---------------------

Name                                               Stmts   Miss  Cover   Missing
--------------------------------------------------------------------------------
kmad_web.py                                            4      0   100%   
kmad_web/default_settings.py                          38      0   100%   
kmad_web/domain.py                                     0      0   100%   
kmad_web/domain/blast.py                               0      0   100%   
kmad_web/domain/blast/provider.py                     31     20    35%   20-25, 28-32, 35-39, 42-48
kmad_web/domain/disorder_prediction.py                 0      0   100%   
kmad_web/domain/disorder_prediction/processor.py     154    139    10%   10-31, 34-45, 48-55, 58-85, 88-96, 99-108, 111-122, 125-136, 139-147, 150-161, 164-171, 174-203
kmad_web/domain/features.py                            0      0   100%   
kmad_web/domain/features/analysis.py                   0      0   100%   
kmad_web/domain/features/analysis/helpers.py          40     32    20%   5-15, 19, 23-26, 30-33, 47-50, 68-76, 92-98
kmad_web/domain/features/analysis/motifs.py           59     50    15%   32-37, 48-66, 70-85, 93-99, 103-121
kmad_web/domain/features/analysis/ptms.py            118    108     8%   21-32, 41-49, 60-82, 86-91, 97-146, 158-177, 181-201, 205-215
kmad_web/domain/features/helpers.py                    0      0   100%   
kmad_web/domain/features/helpers/homology.py          34     28    18%   7-12, 16-23, 27-28, 33-54
kmad_web/domain/features/providers.py                  0      0   100%   
kmad_web/domain/features/providers/elm.py             99     82    17%   15-19, 25-40, 43-45, 48-65, 68-78, 110-116, 119-137, 140-146, 149-158
kmad_web/domain/features/providers/netphos.py         17     11    35%   8, 11-23
kmad_web/domain/features/providers/pfam.py            31     22    29%   14, 17-42
kmad_web/domain/features/providers/uniprot.py         60     44    27%   18-32, 35-47, 50-58, 61-76, 79-90
kmad_web/domain/features/user_features.py             57     49    14%   10-54, 57-67, 70-95, 98-106
kmad_web/domain/fles.py                               38     32    16%   8-17, 21-28, 32-38, 42-50
kmad_web/domain/go.py                                  0      0   100%   
kmad_web/domain/go/providers.py                        0      0   100%   
kmad_web/domain/go/providers/go.py                    33      4    88%   26-27, 35, 42
kmad_web/domain/go/providers/uniprot.py               16      9    44%   12-21
kmad_web/domain/mutation.py                           25     19    24%   9-14, 18-25, 28-38
kmad_web/domain/sequences.py                           0      0   100%   
kmad_web/domain/sequences/align.py                     7      4    43%   6-11
kmad_web/domain/sequences/annotator.py                62     44    29%   17-18, 35-44, 47-52, 55-57, 60-68, 71-75, 78-82, 85-88
kmad_web/domain/sequences/encoder.py                 155    134    14%   11-21, 24-52, 55-64, 67-73, 76-82, 85-86, 89-101, 109-117, 127-139, 144-159, 162-167, 175-181, 189-195, 209-210, 214-229, 232-243
kmad_web/domain/sequences/fasta.py                    62     51    18%   8-15, 19-27, 31-40, 44-53, 57-60, 64-66, 70-98, 102-103
kmad_web/domain/sequences/provider.py                 15      7    53%   12, 15-20
kmad_web/domain/sequences/uniprot_id.py               11      6    45%   10-15
kmad_web/domain/updaters.py                            0      0   100%   
kmad_web/domain/updaters/elm.py                       55     14    75%   33-48, 65, 68, 71-74, 80-81
kmad_web/factory.py                                   39      9    77%   65-74, 93
kmad_web/frontend.py                                   0      0   100%   
kmad_web/frontend/api.py                               0      0   100%   
kmad_web/frontend/api/endpoints.py                    59     44    25%   28-56, 73-82, 97-104, 109-125
kmad_web/frontend/dashboard.py                         0      0   100%   
kmad_web/frontend/dashboard/forms.py                 120     72    40%   33-41, 46-52, 61-62, 77-79, 83-105, 113-150, 166-167, 171-172, 176-177, 181-182, 186-187, 191-192
kmad_web/frontend/dashboard/views.py                 108     78    28%   24-85, 90, 97-98, 103-104, 109-110, 115-116, 121-122, 127-128, 133-134, 139-140, 145-146, 151-152, 157-158, 163-164, 169-170, 175-176, 181, 186-191, 198-203
kmad_web/frontend/filters.py                          23     15    35%   16-38
kmad_web/helpers.py                                    2      1    50%   3
kmad_web/middleware.py                                 0      0   100%   
kmad_web/parsers.py                                    0      0   100%   
kmad_web/parsers/blast.py                             19     16    16%   7-8, 11-24
kmad_web/parsers/elm.py                               40     16    60%   17, 20-29, 35-40
kmad_web/parsers/netphos.py                            9      5    44%   6, 9-12
kmad_web/parsers/pfam.py                              51     44    14%   6, 10, 14, 25-53, 56-84
kmad_web/parsers/types.py                              2      0   100%   
kmad_web/parsers/uniprot.py                          116    103    11%   11-13, 16-42, 45-51, 54-64, 67-92, 95-105, 108-121, 124-138
kmad_web/request_helpers.py                            6      4    33%   5-9
kmad_web/services.py                                   0      0   100%   
kmad_web/services/alignment.py                        72     51    29%   13-14, 18-27, 32-33, 37-51, 56-57, 61-70, 75-76, 80-91, 96-97, 101-115
kmad_web/services/blast.py                            27     16    41%   20-21, 31-48
kmad_web/services/disopred.py                         37     24    35%   19-55
kmad_web/services/elm.py                              82     43    48%   20, 24, 28-43, 51-56, 78, 81-82, 86-112
kmad_web/services/globplot.py                         37     24    35%   19-47
kmad_web/services/go.py                               29      9    69%   18, 22, 28-29, 34-39
kmad_web/services/helpers.py                           0      0   100%   
kmad_web/services/helpers/cache.py                    29      4    86%   16, 24, 30, 33
kmad_web/services/helpers/fieldlist.py                11      8    27%   8-16
kmad_web/services/iupred.py                           47     32    32%   20-47, 51-62
kmad_web/services/kmad.py                            172    145    16%   18-34, 37-52, 57-71, 74-89, 94-95, 98-124, 130-140, 144-166, 173-187, 191-227, 232, 236-239, 246-257, 260-322
kmad_web/services/kmad_aligner.py                     43     29    33%   21-59
kmad_web/services/netphos.py                          34     20    41%   18, 22, 26-48
kmad_web/services/pfam.py                             76     59    22%   16-17, 21, 25, 29-41, 45-63, 66-83, 86-101
kmad_web/services/predisorder.py                      40     27    33%   19-52
kmad_web/services/psipred.py                          49     35    29%   19-57, 60-66
kmad_web/services/spined.py                           43     30    30%   19-57
kmad_web/services/types.py                             4      0   100%   
kmad_web/services/uniprot.py                          54     41    24%   13, 17, 21, 25-39, 43-57, 61-77
kmad_web/tasks.py                                    210    154    27%   44-55, 60-79, 85-103, 108-113, 125-157, 172-179, 189-194, 221-226, 236-248, 259-263, 268-272, 277-298, 314-317, 322, 333-336, 345-362, 371-375
--------------------------------------------------------------------------------
TOTAL                                               2911   2067    29%   
----------------------------------------------------------------------
Ran 1 test in 11.304s

FAILED (errors=1)
joannalange commented 7 years ago

Did you do a pull? The newest version doesn't even call the soap module, and the output shows that this is where it crashes

cbaakman commented 7 years ago

I did a complete pull from https://github.com/cmbi/kmad-web/tree/master and rebuilt the docker images. It gives the above output.

joannalange commented 7 years ago

Ah sorry, my mistake, I looked at a wrong output

joannalange commented 7 years ago

Can you try it again? (sorry, but docker is not working on my machine for some reason, so I cannot check it myself - or maybe could you give me access to one of cmbi's machines on which docker is installed?)

cbaakman commented 7 years ago

The test seems to work fine since your last change, but now the test "unit.test_elm_provider.test_get_motif_instances" fails with the following output:


======================================================================
FAIL: unit.test_elm_provider.test_get_motif_instances
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/usr/local/lib/python2.7/dist-packages/mock/mock.py", line 1305, in patched
    return func(*args, **keywargs)
  File "/usr/src/app/tests/unit/test_elm_provider.py", line 29, in test_get_motif_instances
    eq_(1, len(result))
AssertionError: 1 != 0

Name                                               Stmts   Miss  Cover   Missing
------
joannalange commented 7 years ago

This is fixed in 28ad4c5. All the tests pass on my machine, let me know if it's also the case for you.

joannalange commented 7 years ago

@cbaakman, can I close this issue?

cbaakman commented 7 years ago

Unit tests all work fine now, though I'm not yet finished running all the integration tests.

cbaakman commented 7 years ago

There's a new error in one of the integration tests. This is the output:

tests/integration
docker-compose -f docker-compose.yml -f docker-compose-dev.yml run --rm celery nosetests -v -a !disabled --with-coverage --cover-inclusive --cover-package kmad_web tests/integration
Creating network "kmadweb_default" with the default driver
Creating kmadweb_redis_1
Creating kmadweb_rabbitmq_1
test_elm_update.TestElmUpdate.test_elm_update ... ok
Tests that disorder can be predicted for random sequences. ... 2017-02-07 13:01:11,028 - INFO - N-terminal cut
2017-02-07 13:01:11,029 - INFO - testing sequence: >sp|Q5N1Q1|EFTS_SYNP6
2017-02-07 13:01:11,029 - INFO - Testing output_type: predict
2017-02-07 13:01:11,029 - DEBUG - Posting data: {'seq_data': u'>sp|Q5N1Q1|EFTS_SYNP6 Elongation factor Ts OS=Synechococcus sp. (strain ATCC 27144 / PCC 6301 / SAUG 1402/1) GN=tsf PE=3 SV=1\nAEISAKLVKELREKTGAGMMDCKKALNENDGDLQKAIEWLRQKGIASAEKKSGRTAAEGLVGSYIHTGGRVGVLVEVNCETDFVARGDKFQELVRSIAMQIAACPNVEFVKVEDIPAEIAEREKAIEMGRDDLANKPENIREKIVVGRIEKRLKELTLLDQPYIRDPNISVAELVKQSIAELGENIQVRRFTRFVLGEGIEKAESDFAAEVAAQAAAAQS', 'prediction_methods': 'globplot psipred disopred d2p2 iupred predisorder'}
ERROR
test_uniprot_xml.test_xml ... ok
test_uniprot_xml.test_fetaure_provider ... ok

======================================================================
ERROR: Tests that disorder can be predicted for random sequences.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/usr/src/app/tests/integration/test_kmad_web.py", line 73, in test_sequence
    self._test_sequences(test_sequences)
  File "/usr/src/app/tests/integration/test_kmad_web.py", line 37, in _test_sequences
    r = requests.post(url_create, data=data)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 109, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 50, in request
    response = session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 468, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 423, in send
    raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=5000): Max retries exceeded with url: /api/create/predict/ (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7f353ae08490>: Failed to establish a new connection: [Errno 111] Connection refused',))
-------------------- >> begin captured logging << --------------------
requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection (1): uniprot.org
requests.packages.urllib3.connectionpool: DEBUG: "GET /uniprot/?query=protein&random=yes&format=fasta&fil=reviewed:yes HTTP/1.1" 301 306
requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection (1): www.uniprot.org
requests.packages.urllib3.connectionpool: DEBUG: "GET /uniprot/?query=protein&random=yes&format=fasta&fil=reviewed:yes HTTP/1.1" 302 0
requests.packages.urllib3.connectionpool: DEBUG: "GET /uniprot/Q5N1Q1.fasta?fil=reviewed:yes HTTP/1.1" 200 289
test_kmad_web: INFO: N-terminal cut
test_kmad_web: INFO: testing sequence: >sp|Q5N1Q1|EFTS_SYNP6
test_kmad_web: INFO: Testing output_type: predict
test_kmad_web: DEBUG: Posting data: {'seq_data': u'>sp|Q5N1Q1|EFTS_SYNP6 Elongation factor Ts OS=Synechococcus sp. (strain ATCC 27144 / PCC 6301 / SAUG 1402/1) GN=tsf PE=3 SV=1\nAEISAKLVKELREKTGAGMMDCKKALNENDGDLQKAIEWLRQKGIASAEKKSGRTAAEGLVGSYIHTGGRVGVLVEVNCETDFVARGDKFQELVRSIAMQIAACPNVEFVKVEDIPAEIAEREKAIEMGRDDLANKPENIREKIVVGRIEKRLKELTLLDQPYIRDPNISVAELVKQSIAELGENIQVRRFTRFVLGEGIEKAESDFAAEVAAQAAAAQS', 'prediction_methods': 'globplot psipred disopred d2p2 iupred predisorder'}
requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection (1): 127.0.0.1
--------------------- >> end captured logging << ---------------------

@jonblack, does this test need to run a fake server?

jonblack commented 7 years ago

@cbaakman @joannalange As far as I can tell that test assume that kmad-web is running at 127.0.0.1:5000. You either need the test harness to start the application, which is ugly, or just test using the features provided with flask:

from nose.tools import eq_

from hope.factory import create_app

class TestDashboard(object):

    @classmethod
    def setup_class(cls):
        cls.flask_app = create_app({'TESTING': True,
                                    'SECRET_KEY': 'testing',
                                    'WTF_CSRF_ENABLED': False})
        cls.app = cls.flask_app.test_client()

    def test_index(self):
        rv = self.app.get('/')
        eq_(rv.status_code, 200)

I think that test should be rewritten to use the flask test client shown above. That example was taken from https://github.com/jonblack/hope/blob/master/tests/integration/frontend/test_dashboard.py, and there are more examples like it in the HOPE integration tests.

cbaakman commented 7 years ago

I managed to get past the exceptions by doing the changes mentioned here: https://github.com/cbaakman/kmad-web/commit/f2de25ddad1866e8f0cb862d84bd1012d01c6e77

However, now the test seems to keep PENDING forever. @joannalange do you have any clue why?

jonblack commented 7 years ago

Does kmad-web use celery? I see it in requirements.txt. If so, that's why it's always PENDING. The flask test app will run the web/api but celery isn't running. You can configure celery in the tests to run immediately, negating the need for the celery process to be running. I can't remember off the top of my head what this is, but it's used in HOPE and the celery documentation should cover it.

cbaakman commented 7 years ago

OK, I set CELERY_ALWAYS_EAGER to True and now it doesn't hang forever anymore. I get a new error:

docker-compose -f docker-compose.yml -f docker-compose-dev.yml run --rm celery nosetests -v -a !disabled --with-coverage --cover-inclusive --cover-package kmad_web tests/integration/test_kmad_web.py
Tests that disorder can be predicted for random sequences. ... 2017-02-09 09:02:03,102 - INFO - N-terminal cut
2017-02-09 09:02:03,102 - INFO - testing sequence: >sp|Q9U2Q9|GSK3_CAEEL
2017-02-09 09:02:03,103 - INFO - Testing output_type: predict
2017-02-09 09:02:03,103 - DEBUG - Posting data: {'seq_data': u'>sp|Q9U2Q9|GSK3_CAEEL Glycogen synthase kinase-3 OS=Caenorhabditis elegans GN=gsk-3 PE=1 SV=1\nNKQLLSCSLKSGKQVTMVVASVATDGVDQQVEISYYDQKVIGNGSFGVVFLAKLSTTNEMVAIKKVLQDKRFKNRELQIMRKLNHPNIVKLKYFFYSSGEKKDELYLNLILEYVPETVYRVARHYSKQRQQIPMIYVKLYMYQLLRSLAYIHSIGICHRDIKPQNLLIDPESGVLKLCDFGSAKYLVRNEPNVSYICSRYYRAPELIFGATNYTNSIDVWSAGTVMAELLLGQPIFPGDSGVDQLVEIIKVLGTPTREQIQSMNPNYKEFKFPQIKAHPWNKVFRVHTPAEAIDLISKIIEYTPTSRPTPQAACQHAFFDELRNPDARLPSGRPLPTLEMDGPMGTGEVSTTSGDVAGPSA', 'prediction_methods': 'globplot psipred disopred d2p2 iupred predisorder'}
ERROR

======================================================================
ERROR: Tests that disorder can be predicted for random sequences.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/usr/src/app/tests/integration/test_kmad_web.py", line 85, in test_sequence
    self._test_sequences(test_sequences)
  File "/usr/src/app/tests/integration/test_kmad_web.py", line 49, in _test_sequences
    r = self.app.post(url_create, data=data)
  File "/usr/local/lib/python2.7/dist-packages/werkzeug/test.py", line 788, in post
    return self.open(*args, **kw)
  File "/usr/local/lib/python2.7/dist-packages/flask/testing.py", line 108, in open
    follow_redirects=follow_redirects)
  File "/usr/local/lib/python2.7/dist-packages/werkzeug/test.py", line 751, in open
    response = self.run_wsgi_app(environ, buffered=buffered)
  File "/usr/local/lib/python2.7/dist-packages/werkzeug/test.py", line 668, in run_wsgi_app
    rv = run_wsgi_app(self.application, environ, buffered=buffered)
  File "/usr/local/lib/python2.7/dist-packages/werkzeug/test.py", line 871, in run_wsgi_app
    app_rv = app(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/src/app/kmad_web/middleware.py", line 36, in __call__
    return self.app(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/src/app/kmad_web/frontend/api/endpoints.py", line 54, in create_kmad
    celery_id = strategy()
  File "/usr/src/app/kmad_web/services/kmad.py", line 123, in __call__
    job = workflow()
  File "/usr/local/lib/python2.7/dist-packages/celery/canvas.py", line 636, in __call__
    return self.apply_async((), {'body': body} if body else {}, **options)
  File "/usr/local/lib/python2.7/dist-packages/celery/canvas.py", line 629, in apply_async
    return self.apply((), kwargs, task_id=task_id, **options)
  File "/usr/local/lib/python2.7/dist-packages/celery/canvas.py", line 181, in apply
    return self.type.apply(args, kwargs, **options)
  File "/usr/local/lib/python2.7/dist-packages/celery/app/builtins.py", line 378, in apply
    args=(res.get(propagate=propagate).get(), ))
  File "/usr/local/lib/python2.7/dist-packages/celery/result.py", line 578, in get
    interval=interval, callback=callback, no_ack=no_ack)
  File "/usr/local/lib/python2.7/dist-packages/celery/result.py", line 642, in join
    interval=interval, no_ack=no_ack,
  File "/usr/local/lib/python2.7/dist-packages/celery/result.py", line 870, in get
    raise self.result
OSError: [Errno 2] No such file or directory

@joannalange do you know what file it is missing?