question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

All crud tests are failing

See original GitHub issue

I’m submitting a

  • bug report.
  • feature request.

Current Behaviour:

All crud tests either have warnings or they’re failing.

(hydra) xadahiya@xa-Inspiron-7560:~/hydra/hydrus/hydrus/tests$ python -m unittest test_crud.py 
Creating a temporary datatbsse...
Classes and properties added successfully.
Setup done, running tests...
EEEEEF.EEEEE
======================================================================
ERROR: test_delete (test_crud.TestCRUD)
Test CRUD delete.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/xadahiya/hydra/hydrus/hydrus/tests/test_crud.py", line 99, in test_delete
    object_=object_, id_=id_, session=self.session)
  File "/home/xadahiya/hydra/hydrus/hydrus/data/crud.py", line 145, in insert
    RDFClass.name == object_["@type"]).one()
TypeError: 'NoneType' object is not subscriptable

======================================================================
ERROR: test_delete_id (test_crud.TestCRUD)
Test CRUD delete when wrong/undefined ID is given.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/xadahiya/hydra/hydrus/hydrus/tests/test_crud.py", line 159, in test_delete_id
    object_=object_, id_=id_, session=self.session)
  File "/home/xadahiya/hydra/hydrus/hydrus/data/crud.py", line 145, in insert
    RDFClass.name == object_["@type"]).one()
TypeError: 'NoneType' object is not subscriptable

======================================================================
ERROR: test_delete_ids (test_crud.TestCRUD)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/xadahiya/hydra/hydrus/hydrus/tests/test_crud.py", line 217, in test_delete_ids
    session=self.session, id_=ids)
  File "/home/xadahiya/hydra/hydrus/hydrus/data/crud.py", line 249, in insert_multiple
    RDFClass.name == objects_[index]["@type"]).one()
TypeError: 'NoneType' object is not subscriptable

======================================================================
ERROR: test_delete_type (test_crud.TestCRUD)
Test CRUD delete when wrong/undefined class is given.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/xadahiya/hydra/hydrus/hydrus/tests/test_crud.py", line 143, in test_delete_type
    object_=object_, id_=id_, session=self.session)
  File "/home/xadahiya/hydra/hydrus/hydrus/data/crud.py", line 145, in insert
    RDFClass.name == object_["@type"]).one()
TypeError: 'NoneType' object is not subscriptable

======================================================================
ERROR: test_get (test_crud.TestCRUD)
Test CRUD get.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/xadahiya/hydra/hydrus/hydrus/tests/test_crud.py", line 68, in test_get
    response = crud.insert(object_=object_, id_=id_, session=self.session)
  File "/home/xadahiya/hydra/hydrus/hydrus/data/crud.py", line 145, in insert
    RDFClass.name == object_["@type"]).one()
TypeError: 'NoneType' object is not subscriptable

======================================================================
ERROR: test_insert (test_crud.TestCRUD)
Test CRUD insert.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/xadahiya/hydra/hydrus/hydrus/tests/test_crud.py", line 61, in test_insert
    response = crud.insert(object_=object_, id_=1, session=self.session)
  File "/home/xadahiya/hydra/hydrus/hydrus/data/crud.py", line 145, in insert
    RDFClass.name == object_["@type"]).one()
TypeError: 'NoneType' object is not subscriptable

======================================================================
ERROR: test_insert_id (test_crud.TestCRUD)
Test CRUD insert when used ID is given.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/xadahiya/hydra/hydrus/hydrus/tests/test_crud.py", line 190, in test_insert_id
    object_=object_, id_=id_, session=self.session)
  File "/home/xadahiya/hydra/hydrus/hydrus/data/crud.py", line 145, in insert
    RDFClass.name == object_["@type"]).one()
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/xadahiya/hydra/hydrus/hydrus/tests/test_crud.py", line 192, in test_insert_id
    response_code, message = e.get_HTTP()
AttributeError: 'TypeError' object has no attribute 'get_HTTP'

======================================================================
ERROR: test_insert_ids (test_crud.TestCRUD)
Test CRUD insert when multiple ID's are given
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/xadahiya/hydra/hydrus/hydrus/tests/test_crud.py", line 205, in test_insert_ids
    objects_=objects, session=self.session, id_=ids)
  File "/home/xadahiya/hydra/hydrus/hydrus/data/crud.py", line 249, in insert_multiple
    RDFClass.name == objects_[index]["@type"]).one()
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/xadahiya/hydra/hydrus/hydrus/tests/test_crud.py", line 207, in test_insert_ids
    response_code, message = e.get_HTTP()
AttributeError: 'TypeError' object has no attribute 'get_HTTP'

======================================================================
ERROR: test_insert_type (test_crud.TestCRUD)
Test CRUD insert when wrong/undefined class is given.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/xadahiya/hydra/hydrus/hydrus/tests/test_crud.py", line 174, in test_insert_type
    object_["@type"] = "otherClass"
TypeError: 'NoneType' object does not support item assignment

======================================================================
ERROR: test_update (test_crud.TestCRUD)
Test CRUD update.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/xadahiya/hydra/hydrus/hydrus/tests/test_crud.py", line 80, in test_update
    object_=object_, id_=id_, session=self.session)
  File "/home/xadahiya/hydra/hydrus/hydrus/data/crud.py", line 145, in insert
    RDFClass.name == object_["@type"]).one()
TypeError: 'NoneType' object is not subscriptable

======================================================================
FAIL: test_get_id (test_crud.TestCRUD)
Test CRUD get when wrong/undefined ID is given.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/xadahiya/hydra/hydrus/hydrus/tests/test_crud.py", line 124, in test_get_id
    assert 404 == response_code
AssertionError

----------------------------------------------------------------------
Ran 12 tests in 0.027s

FAILED (failures=1, errors=10)

Expected Behaviour:

All tests should pass

Steps to reproduce:

Run tests_crud.py using the parser generated doc

Do you want to work on this issue?

NO

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
vaibhavchellanicommented, Jul 11, 2018

@xadahiya should we close this then ?

1reaction
xadahiyacommented, Jul 11, 2018

Okay, create a PR for this. I do have some ideas for improving tests, will write details in the PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do you test your CRUD operations? - Codebots
Some developers skip this all important step for a number of reasons, one of those reasons could be that they do not know...
Read more >
Pytest Failing Tests Even Though The Test Is Actually Working ...
I think you are misunderstanding how pytest fixtures work. Fixtures are prerequesites for tests, that are initialized before the test runs.
Read more >
How to test a C.R.U.D. on android without affecting the main ...
Coding the project. First, create two packages with the names controller and database. Basically all business logic to create the database and do...
Read more >
Am I doing TDD wrong when multiple tests can fail for the ...
However, all the tests above will fail if the method returns null. I feel like a single error should only result in one...
Read more >
Write Go unit tests for db CRUD with random data
This function will return an exit code, which tell us whether the tests pass or fail. Then we should report it back to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found