@@ -57,16 +57,44 @@ And you ready to start development!
57
57
58
58
<!-- TODO: Provide environment.yml file for conda env -->
59
59
60
+ ## Coding guidelines
61
+
62
+ Several tools are used to ensure a coherent coding style.
63
+ You need to make sure that your code satisfy those requirements
64
+ or the automated tests will fail.
65
+
66
+ - [ black code formatter] ( https://github.com/psf/black )
67
+ - [ flake8 style enforcement] ( https://flake8.pycqa.org/en/latest/index.html )
68
+ - [ mypy static type checker] ( http://mypy-lang.org/ )
69
+ - [ isort to sort imports alphabetically] ( https://isort.readthedocs.io/en/stable/ )
70
+
71
+ On Linux or MacOS, you can fix and check your code style by running
72
+ the Makefile command ` make check ` (this is also checked by running
73
+ the automated tests with tox but it is much faster with make)
74
+
75
+ In addition to the above checks, it is asked that:
76
+
77
+ - [ type hints are used] ( https://docs.python.org/3/library/typing.html )
78
+ - tests are added to ensure complete code coverage
79
+
60
80
## Running tests
61
81
62
82
After developing, the full test suite can be evaluated by running:
63
83
64
84
``` sh
65
- pytest tests --cov=gql -vv
85
+ pytest tests --cov=gql --cov-report=term-missing - vv
66
86
```
67
87
68
- If you are using Linux or MacOS, you can make use of Makefile command
69
- ` make tests ` , which is a shortcut for the above python command.
88
+ Please note that some tests which require external online resources are not
89
+ done in the automated tests. You can run those tests by running:
90
+
91
+ ``` sh
92
+ pytest tests --cov=gql --cov-report=term-missing --run-online -vv
93
+ ```
94
+
95
+ If you are using Linux or MacOS, you can make use of Makefile commands
96
+ ` make tests ` and ` make all_tests ` , which are shortcuts for the above
97
+ python commands.
70
98
71
99
You can also test on several python environments by using tox.
72
100
@@ -91,7 +119,24 @@ conda install -c conda-forge tox-conda
91
119
92
120
This install tox underneath so no need to install it before.
93
121
94
- Then uncomment the ` requires = tox-conda ` line on ` tox.ini ` file.
122
+ Then add the line ` requires = tox-conda ` in the ` tox.ini ` file under ` [tox] ` .
95
123
96
124
Run ` tox ` and you will see all the environments being created
97
125
and all passing tests. :rocket :
126
+
127
+ ## How to create a good Pull Request
128
+
129
+ 1 . Make a fork of the master branch on github
130
+ 2 . Clone your forked repo on your computer
131
+ 3 . Create a feature branch ` git checkout -b feature_my_awesome_feature `
132
+ 4 . Modify the code
133
+ 5 . Verify that the [ Coding guidelines] ( #coding-guidelines ) are respected
134
+ 6 . Verify that the [ automated tests] ( #running-tests ) are passing
135
+ 7 . Make a commit and push it to your fork
136
+ 8 . From github, create the pull request. Automated tests from travis
137
+ and coveralls will then automatically run the tests and check the code coverage
138
+ 9 . If other modifications are needed, you are free to create more commits and
139
+ push them on your branch. They'll get added to the PR automatically.
140
+
141
+ Once the Pull Request is accepted and merged, you can safely
142
+ delete the branch (and the forked repo if no more development is needed).
0 commit comments