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.

GraphQLTestCase inherits from Django's TestCase, which requires a database

See original GitHub issue

I’m using Django in a project which doesn’t use a database, however I can’t use graphene-django’s GraphQLTestCase, as it inherits from Django’s TestCase (I’m using SimpleTestCase elsewhere).

Could GraphQLTestCase extend from SimpleTestCase? Or if this is not desired because the most common usage does involve a database, could we move the methods to a mixin, so I can use this in combination with SimpleTestCase?

I can’t see anything in GraphQLTestCase which actually requires a Django database to be configured.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ulgenscommented, May 23, 2020

Maybe another test class like GraphQLSimpleTestCase?

0reactions
stale[bot]commented, Aug 27, 2020

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Testing Django GraphQL API with database - Stack Overflow
I read in Django Test Database looks empty while test is runnin that this is a result from GraphQLTestCase inheriting from TestCase.
Read more >
Testing tools - Django documentation
It inherits from TransactionTestCase (and by extension SimpleTestCase ). If your Django application doesn't use a database, use SimpleTestCase .
Read more >
Django + Graphene: From REST to GraphQL - FullStack Labs
This walk-through demonstrates the power of using Graphene with Django by covering the ... our test class must inherit from the GraphQLTestCase class, ......
Read more >
Testing API calls with django - Graphene-Python
If you want to unittest your API calls derive your test case from the class GraphQLTestCase . Your endpoint is set through the...
Read more >
Testing Your Django App With Pytest
TestCase . We'll use it constantly, because Django needs access to DB. If you want to get access to the Django database inside...
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