Skip to content

Commit

Permalink
Fix python testing (#43)
Browse files Browse the repository at this point in the history
* Add tox to python review actions

* Fix non-deterministic query_ef test

* Fix formatting for python tests

* Update black line-length to 120

* Reduce noise from clang-format

* Add python3 to tox allowlist

* Update style docs

* Remove test restriction from pytest

* Update python generate script and requirements

* Update docs with latest furo deps

* Try to fix windows tox runs
  • Loading branch information
markkohdev authored Nov 14, 2023
1 parent f95514b commit 3d59284
Show file tree
Hide file tree
Showing 26 changed files with 125 additions and 131 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ jobs:
pip install -r dev-requirements.txt
- name: Build voyager locally
run: python setup.py develop
- name: Run tests
run: pytest -v --durations=100 -x
- name: Run tox tests
run: tox

run-python-tests-with-address-sanitizer:
defaults:
Expand Down Expand Up @@ -151,13 +151,13 @@ jobs:
CC: clang
CXX: clang++
run: python setup.py develop
- name: Run tests with ASan loaded
- name: Run tox tests with ASan loaded
# pytest can exit before all Python objects have been destroyed,
# so we tell ASan to ignore leaks.
run: |
ASAN_OPTIONS=detect_leaks=0 \
LD_PRELOAD=$(clang -print-file-name=libclang_rt.asan-x86_64.so) \
pytest -v -x -s
tox
build-python-wheels:
needs: [run-python-tests, run-python-tests-with-address-sanitizer]
Expand Down
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ tox
Use [`clang-format`](https://clang.llvm.org/docs/ClangFormat.html) for C++ code, and `black` with defaults for Python code.
In order to check and run formatting within the python module, you can use tox to facilitate this.
```bash
cd python
# Check formatting only (don't change files)
tox -e check-formatting
# Run formatter for python bindings and native python code
tox -e format
```
## Issues
When creating an issue please try to ahere to the following format:
Expand Down
5 changes: 4 additions & 1 deletion docs/python/_static/basic.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Sphinx stylesheet -- basic theme.
*
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
Expand Down Expand Up @@ -324,13 +324,15 @@ aside.sidebar {
p.sidebar-title {
font-weight: bold;
}

nav.contents,
aside.topic,
div.admonition, div.topic, blockquote {
clear: left;
}

/* -- topics ---------------------------------------------------------------- */

nav.contents,
aside.topic,
div.topic {
Expand Down Expand Up @@ -606,6 +608,7 @@ ol.simple p,
ul.simple p {
margin-bottom: 0;
}

aside.footnote > span,
div.citation > span {
float: left;
Expand Down
4 changes: 2 additions & 2 deletions docs/python/_static/copybutton.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const messages = {
},
'fr' : {
'copy': 'Copier',
'copy_to_clipboard': 'Copié dans le presse-papier',
'copy_to_clipboard': 'Copier dans le presse-papier',
'copy_success': 'Copié !',
'copy_failure': 'Échec de la copie',
},
Expand Down Expand Up @@ -224,7 +224,7 @@ var copyTargetText = (trigger) => {
var target = document.querySelector(trigger.attributes['data-clipboard-target'].value);

// get filtered text
let exclude = '.linenos, .gp';
let exclude = '.linenos';

let text = filterText(target, exclude);
return formatCopyText(text, '', false, true, true, true, '', '')
Expand Down
2 changes: 1 addition & 1 deletion docs/python/_static/debug.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ body {
.sb-footer__inner {
background: salmon;
}
[role="main"] {
.sb-article {
background: white;
}
2 changes: 1 addition & 1 deletion docs/python/_static/doctools.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Base JavaScript utilities for all Sphinx HTML documentation.
*
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
Expand Down
2 changes: 1 addition & 1 deletion docs/python/_static/language_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* This script contains the language-specific data used by searchtools.js,
* namely the list of stopwords, stemmer, scorer and splitter.
*
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
Expand Down
4 changes: 2 additions & 2 deletions docs/python/_static/pygments.css
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ body[data-theme="dark"] .highlight .x { color: #d0d0d0 } /* Other */
body[data-theme="dark"] .highlight .p { color: #d0d0d0 } /* Punctuation */
body[data-theme="dark"] .highlight .ch { color: #ababab; font-style: italic } /* Comment.Hashbang */
body[data-theme="dark"] .highlight .cm { color: #ababab; font-style: italic } /* Comment.Multiline */
body[data-theme="dark"] .highlight .cp { color: #cd2828; font-weight: bold } /* Comment.Preproc */
body[data-theme="dark"] .highlight .cp { color: #ff3a3a; font-weight: bold } /* Comment.Preproc */
body[data-theme="dark"] .highlight .cpf { color: #ababab; font-style: italic } /* Comment.PreprocFile */
body[data-theme="dark"] .highlight .c1 { color: #ababab; font-style: italic } /* Comment.Single */
body[data-theme="dark"] .highlight .cs { color: #e50808; font-weight: bold; background-color: #520000 } /* Comment.Special */
Expand Down Expand Up @@ -186,7 +186,7 @@ body:not([data-theme="light"]) .highlight .x { color: #d0d0d0 } /* Other */
body:not([data-theme="light"]) .highlight .p { color: #d0d0d0 } /* Punctuation */
body:not([data-theme="light"]) .highlight .ch { color: #ababab; font-style: italic } /* Comment.Hashbang */
body:not([data-theme="light"]) .highlight .cm { color: #ababab; font-style: italic } /* Comment.Multiline */
body:not([data-theme="light"]) .highlight .cp { color: #cd2828; font-weight: bold } /* Comment.Preproc */
body:not([data-theme="light"]) .highlight .cp { color: #ff3a3a; font-weight: bold } /* Comment.Preproc */
body:not([data-theme="light"]) .highlight .cpf { color: #ababab; font-style: italic } /* Comment.PreprocFile */
body:not([data-theme="light"]) .highlight .c1 { color: #ababab; font-style: italic } /* Comment.Single */
body:not([data-theme="light"]) .highlight .cs { color: #e50808; font-weight: bold; background-color: #520000 } /* Comment.Special */
Expand Down
2 changes: 1 addition & 1 deletion docs/python/_static/scripts/furo.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/python/_static/scripts/furo.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/python/_static/searchtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Sphinx JavaScript utilities for the full-text search.
*
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
Expand Down
44 changes: 22 additions & 22 deletions docs/python/_static/skeleton.css
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,19 @@ article {

.sb-article-container,
.sb-footer-content__inner,
.drop-secondary-sidebar-for-full-width-content [role="main"],
.drop-secondary-sidebar-for-full-width-content .sb-article,
.drop-secondary-sidebar-for-full-width-content .match-content-width {
width: 100vw;
}

[role="main"],
.sb-article,
.match-content-width {
padding: 0 1rem;
box-sizing: border-box;
}

@media (min-width: 32rem) {
[role="main"],
.sb-article,
.match-content-width {
padding: 0 2rem;
}
Expand All @@ -167,33 +167,33 @@ article {
width: auto;
}
.sb-footer-content__inner,
.drop-secondary-sidebar-for-full-width-content [role="main"],
.drop-secondary-sidebar-for-full-width-content .sb-article,
.drop-secondary-sidebar-for-full-width-content .match-content-width {
width: 42rem;
}
[role="main"],
.sb-article,
.match-content-width {
width: 42rem;
}
}
@media (min-width: 46rem) {
.sb-footer-content__inner,
.drop-secondary-sidebar-for-full-width-content [role="main"],
.drop-secondary-sidebar-for-full-width-content .sb-article,
.drop-secondary-sidebar-for-full-width-content .match-content-width {
width: 46rem;
}
[role="main"],
.sb-article,
.match-content-width {
width: 46rem;
}
}
@media (min-width: 50rem) {
.sb-footer-content__inner,
.drop-secondary-sidebar-for-full-width-content [role="main"],
.drop-secondary-sidebar-for-full-width-content .sb-article,
.drop-secondary-sidebar-for-full-width-content .match-content-width {
width: 50rem;
}
[role="main"],
.sb-article,
.match-content-width {
width: 50rem;
}
Expand All @@ -208,33 +208,33 @@ article {
display: none !important;
}
.sb-footer-content__inner,
.drop-secondary-sidebar-for-full-width-content [role="main"],
.drop-secondary-sidebar-for-full-width-content .sb-article,
.drop-secondary-sidebar-for-full-width-content .match-content-width {
width: 59rem;
}
[role="main"],
.sb-article,
.match-content-width {
width: 42rem;
}
}
@media (min-width: 63rem) {
.sb-footer-content__inner,
.drop-secondary-sidebar-for-full-width-content [role="main"],
.drop-secondary-sidebar-for-full-width-content .sb-article,
.drop-secondary-sidebar-for-full-width-content .match-content-width {
width: 63rem;
}
[role="main"],
.sb-article,
.match-content-width {
width: 46rem;
}
}
@media (min-width: 67rem) {
.sb-footer-content__inner,
.drop-secondary-sidebar-for-full-width-content [role="main"],
.drop-secondary-sidebar-for-full-width-content .sb-article,
.drop-secondary-sidebar-for-full-width-content .match-content-width {
width: 67rem;
}
[role="main"],
.sb-article,
.match-content-width {
width: 50rem;
}
Expand All @@ -249,44 +249,44 @@ article {
display: none !important;
}
.sb-footer-content__inner,
.drop-secondary-sidebar-for-full-width-content [role="main"],
.drop-secondary-sidebar-for-full-width-content .sb-article,
.drop-secondary-sidebar-for-full-width-content .match-content-width {
width: 59rem;
}
[role="main"],
.sb-article,
.match-content-width {
width: 42rem;
}
}

/* Full desktop views */
@media (min-width: 80rem) {
[role="main"],
.sb-article,
.match-content-width {
width: 46rem;
}
.sb-footer-content__inner,
.drop-secondary-sidebar-for-full-width-content [role="main"],
.drop-secondary-sidebar-for-full-width-content .sb-article,
.drop-secondary-sidebar-for-full-width-content .match-content-width {
width: 63rem;
}
}

@media (min-width: 84rem) {
[role="main"],
.sb-article,
.match-content-width {
width: 50rem;
}
.sb-footer-content__inner,
.drop-secondary-sidebar-for-full-width-content [role="main"],
.drop-secondary-sidebar-for-full-width-content .sb-article,
.drop-secondary-sidebar-for-full-width-content .match-content-width {
width: 67rem;
}
}

@media (min-width: 88rem) {
.sb-footer-content__inner,
.drop-secondary-sidebar-for-full-width-content [role="main"],
.drop-secondary-sidebar-for-full-width-content .sb-article,
.drop-secondary-sidebar-for-full-width-content .match-content-width {
width: 67rem;
}
Expand Down
2 changes: 1 addition & 1 deletion docs/python/_static/styles/furo.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/python/_static/styles/furo.css.map

Large diffs are not rendered by default.

Loading

0 comments on commit 3d59284

Please sign in to comment.