Skip to content

Commit fef7439

Browse files
author
Daniel Gallagher
committed
Merge branch 'master' of github.com:dan98765/graphql-core into travis_uses_tox
2 parents 02b231a + 148cdb4 commit fef7439

File tree

185 files changed

+17308
-11434
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+17308
-11434
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,7 @@ target/
6767

6868
# OS X
6969
.DS_Store
70+
/.mypy_cache
71+
.pyre
72+
/.vscode
73+
/type_info.json

README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,20 +114,37 @@ from graphql.execution.execute import execute
114114
execute(schema, ast, executor=SyncExecutor())
115115
```
116116

117-
### Development
117+
### Contributing
118118

119-
Install development and test dependencies:
119+
After cloning this repo, create a [virtualenv](https://virtualenv.pypa.io/en/stable/) and ensure dependencies are installed by running:
120120

121121
```sh
122+
virtualenv venv
123+
source venv/bin/activate
122124
pip install -e ".[test]"
123125
```
124126

125-
Run test suite:
127+
Well-written tests and maintaining good test coverage is important to this project. While developing, run new and existing tests with:
126128

127129
```sh
128-
pytest
130+
py.test PATH/TO/MY/DIR/test_test.py # Single file
131+
py.test PATH/TO/MY/DIR/ # All tests in directory
129132
```
130133

134+
Add the `-s` flag if you have introduced breakpoints into the code for debugging.
135+
Add the `-v` ("verbose") flag to get more detailed test output. For even more detailed output, use `-vv`.
136+
Check out the [pytest documentation](https://docs.pytest.org/en/latest/) for more options and test running controls.
137+
138+
GraphQL-core supports several versions of Python. To make sure that changes do not break compatibility with any of those versions, we use `tox` to create virtualenvs for each python version and run tests with that version. To run against all python versions defined in the `tox.ini` config file, just run:
139+
```sh
140+
tox
141+
```
142+
If you wish to run against a specific version defined in the `tox.ini` file:
143+
```sh
144+
tox -e py36
145+
```
146+
Tox can only use whatever versions of python are installed on your system. When you create a pull request, Travis will also be running the same tests and report the results, so there is no need for potential contributors to try to install every single version of python on their own system ahead of time. We appreciate opening issues and pull requests to make GraphQL-core even more stable & useful!
147+
131148
## Main Contributors
132149

133150
* [@syrusakbary](https://github.com/syrusakbary/)

conftest.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Configuration for pytest to automatically collect types.
2+
# Thanks to Guilherme Salgado.
3+
import pytest
4+
5+
try:
6+
import pyannotate_runtime
7+
PYANOTATE_PRESENT = True
8+
except ImportError:
9+
PYANOTATE_PRESENT = False
10+
11+
if PYANOTATE_PRESENT:
12+
def pytest_collection_finish(session):
13+
"""Handle the pytest collection finish hook: configure pyannotate.
14+
Explicitly delay importing `collect_types` until all tests have
15+
been collected. This gives gevent a chance to monkey patch the
16+
world before importing pyannotate.
17+
"""
18+
from pyannotate_runtime import collect_types
19+
collect_types.init_types_collection()
20+
21+
@pytest.fixture(autouse=True)
22+
def collect_types_fixture():
23+
from pyannotate_runtime import collect_types
24+
collect_types.resume()
25+
yield
26+
collect_types.pause()
27+
28+
def pytest_sessionfinish(session, exitstatus):
29+
from pyannotate_runtime import collect_types
30+
collect_types.dump_stats("type_info.json")

0 commit comments

Comments
 (0)