Skip to content

Commit

Permalink
Merge branch 'master' of github.com:dan98765/graphql-core into travis…
Browse files Browse the repository at this point in the history
…_uses_tox
  • Loading branch information
Daniel Gallagher committed Jul 6, 2018
2 parents 02b231a + 148cdb4 commit fef7439
Show file tree
Hide file tree
Showing 185 changed files with 17,308 additions and 11,434 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,7 @@ target/

# OS X
.DS_Store
/.mypy_cache
.pyre
/.vscode
/type_info.json
25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,20 +114,37 @@ from graphql.execution.execute import execute
execute(schema, ast, executor=SyncExecutor())
```

### Development
### Contributing

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

```sh
virtualenv venv
source venv/bin/activate
pip install -e ".[test]"
```

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

```sh
pytest
py.test PATH/TO/MY/DIR/test_test.py # Single file
py.test PATH/TO/MY/DIR/ # All tests in directory
```

Add the `-s` flag if you have introduced breakpoints into the code for debugging.
Add the `-v` ("verbose") flag to get more detailed test output. For even more detailed output, use `-vv`.
Check out the [pytest documentation](https://docs.pytest.org/en/latest/) for more options and test running controls.

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:
```sh
tox
```
If you wish to run against a specific version defined in the `tox.ini` file:
```sh
tox -e py36
```
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!

## Main Contributors

* [@syrusakbary](https://github.com/syrusakbary/)
Expand Down
30 changes: 30 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Configuration for pytest to automatically collect types.
# Thanks to Guilherme Salgado.
import pytest

try:
import pyannotate_runtime
PYANOTATE_PRESENT = True
except ImportError:
PYANOTATE_PRESENT = False

if PYANOTATE_PRESENT:
def pytest_collection_finish(session):
"""Handle the pytest collection finish hook: configure pyannotate.
Explicitly delay importing `collect_types` until all tests have
been collected. This gives gevent a chance to monkey patch the
world before importing pyannotate.
"""
from pyannotate_runtime import collect_types
collect_types.init_types_collection()

@pytest.fixture(autouse=True)
def collect_types_fixture():
from pyannotate_runtime import collect_types
collect_types.resume()
yield
collect_types.pause()

def pytest_sessionfinish(session, exitstatus):
from pyannotate_runtime import collect_types
collect_types.dump_stats("type_info.json")
Loading

0 comments on commit fef7439

Please sign in to comment.