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.

Remove promise import from graphene.test.Client

See original GitHub issue
  • What is the current behavior? Installing graphene==v3.0.0b5 does not auto install promise which is required when writing tests using graphene.test.Client (see here)
venv 福 pip install graphene==3.0.0b5                        
Collecting graphene==3.0.0b5
  Using cached graphene-3.0b5-py2.py3-none-any.whl (106 kB)
Collecting aniso8601<9,>=8
  Using cached aniso8601-8.0.0-py2.py3-none-any.whl (43 kB)
Collecting graphql-relay<4,>=3.0
  Using cached graphql_relay-3.0.0-py3-none-any.whl (15 kB)
Collecting graphql-core<4,>=3.1.2
  Using cached graphql_core-3.1.2-py3-none-any.whl (183 kB)
Installing collected packages: aniso8601, graphql-core, graphql-relay, graphene
Successfully installed aniso8601-8.0.0 graphene-3.0b5 graphql-core-3.1.2 graphql-relay-3.0.0

/tmp/graphene master
venv 福 pip freeze
aniso8601==8.0.0
graphene==3.0b5
graphql-core==3.1.2
graphql-relay==3.0.0
  • What is the expected behavior? The installation procedure installs promise as it’s currently being done with the version v2.1.8
venv 福 pip install graphene                                 
Collecting graphene
  Using cached graphene-2.1.8-py2.py3-none-any.whl (107 kB)
Collecting graphql-relay<3,>=2
  Using cached graphql_relay-2.0.1-py3-none-any.whl (20 kB)
Collecting graphql-core<3,>=2.1
  Using cached graphql_core-2.3.2-py2.py3-none-any.whl (252 kB)
Collecting six<2,>=1.10.0
  Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting aniso8601<=7,>=3
  Using cached aniso8601-7.0.0-py2.py3-none-any.whl (42 kB)
Processing /home/valz/.cache/pip/wheels/54/aa/01/724885182f93150035a2a91bce34a12877e8067a97baaf5dc8/promise-2.3-py3-none-any.whl
Collecting rx<2,>=1.6
  Using cached Rx-1.6.1-py2.py3-none-any.whl (179 kB)
Installing collected packages: rx, six, promise, graphql-core, graphql-relay, aniso8601, graphene
Successfully installed aniso8601-7.0.0 graphene-2.1.8 graphql-core-2.3.2 graphql-relay-2.0.1 promise-2.3 rx-1.6.1 six-1.15.0

/tmp/graphene master
venv 福 pip freeze
aniso8601==7.0.0
graphene==2.1.8
graphql-core==2.3.2
graphql-relay==2.0.1
promise==2.3
Rx==1.6.1
six==1.15.0
  • What is the motivation / use case for changing the behavior? I wrote tests using the test client, and while everything worked fine on my laptop at first (I may have installed graphene v2 before the v3), our CI freshly installed from v3 and failed to run tests because of this missing package, which made me realize there seems to be a packaging issue on your side (we use poetry with poetry add graphene --allow-prereleases - but pip failed to install the expected dep as well)

  • Please tell us about your environment:

    • Version: v3.0.0b5
    • Platform: ArchLinux x86_64 Linux 5.8.1-arch1-1
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow)

Actual stacktrace from my failing CI job

ImportError while importing test module '/builds/redacted/redacted/redacted/tests/test_graphql.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
redacted/tests/test_graphql.py:6: in <module>
    from graphene.test import Client
/var/www/.cache/pypoetry/virtualenvs/redacted-674zaAdZ-py3.8/lib/python3.8/site-packages/graphene/test/__init__.py:1: in <module>
    from promise import Promise, is_thenable
E   ModuleNotFoundError: No module named 'promise'

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
x0y-gtcommented, Dec 7, 2021

Having the same issue here 0/

0reactions
bitnahiancommented, Feb 14, 2022

Same issue. My CI fails with the following error:

==================================== ERRORS ====================================
__________________ ERROR collecting tests/e2e/schema_test.py ___________________
ImportError while importing test module '/opt/atlassian/pipelines/agent/build/api/tests/e2e/schema_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/e2e/schema_test.py:1: in <module>
    from graphene.test import Client
/usr/local/lib/python3.8/site-packages/graphene/test/__init__.py:1: in <module>
    from promise import Promise, is_thenable
E   ModuleNotFoundError: No module named 'promise'
=========================== short test summary info ============================
ERROR tests/e2e/schema_test.py
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 1.23s ===============================
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to mock info.context in Django / Graphene tests
What you need to do is create a test client, and then provide the test context value to use for the test. from...
Read more >
Full Stack Error Handling with GraphQL and Apollo
import ApolloClient from 'apollo-boost'; const client = new ApolloClient({ uri: '<your graphql endpoint>', // Apollo Boost allows you to specify ...
Read more >
Test Client - Graphene-Python
The test client is a Python class that acts as a dummy GraphQL client, allowing you to test your views and interact with...
Read more >
Graphene Documentation
from graphene import ObjectType, String, Schema ... The test client is a Python class that acts as a dummy GraphQL client, allowing you...
Read more >
tiangolo/fastapi - Gitter
@tiangolo yes, it's a graphene question, but the office graphene is more ... the doc for aysnc graphql test is good for save...
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