File tree 2 files changed +59
-0
lines changed
2 files changed +59
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Test Python package
2
+ on :
3
+ push :
4
+ branches :
5
+ - main
6
+ pull_request :
7
+ workflow_dispatch :
8
+
9
+ # When this workflow is queued, automatically cancel any previous running
10
+ # or pending jobs from the same branch
11
+ concurrency :
12
+ group : test-${{ github.ref }}
13
+ cancel-in-progress : true
14
+
15
+ jobs :
16
+ build_and_test :
17
+ runs-on : ${{ matrix.os }}
18
+ strategy :
19
+ fail-fast : false
20
+ matrix :
21
+ os : [ubuntu-latest]
22
+ python-version : ["3.10"]
23
+ steps :
24
+ - uses : actions/checkout@v4
25
+ - name : Set up Python ${{ matrix.python-version }}
26
+ uses : actions/setup-python@v5
27
+ with :
28
+ python-version : ${{ matrix.python-version }}
29
+ - name : Install NeMo-Curator and pytest
30
+ # TODO: Remove pytest when optional test dependencies are added to setup.py
31
+
32
+ # Installing wheel beforehand due to fasttext issue:
33
+ # https://github.com/facebookresearch/fastText/issues/512#issuecomment-1837367666
34
+ # Explicitly install cython: https://github.com/VKCOM/YouTokenToMe/issues/94
35
+ run : |
36
+ pip install wheel cython
37
+ pip install --no-cache-dir --extra-index-url https://pypi.nvidia.com .
38
+ pip install pytest
39
+ - name : Run tests
40
+ # TODO: Remove env variable when gpu dependencies are optional
41
+ run : |
42
+ RAPIDS_NO_INITIALIZE=1 python -m pytest -v --cpu
43
+
44
+
Original file line number Diff line number Diff line change
1
+ import pytest
2
+
3
+
4
+ def pytest_addoption (parser ):
5
+ parser .addoption (
6
+ "--cpu" , action = "store_true" , default = False , help = "Run tests without gpu marker"
7
+ )
8
+
9
+
10
+ def pytest_collection_modifyitems (config , items ):
11
+ if config .getoption ("--cpu" ):
12
+ skip_gpu = pytest .mark .skip (reason = "Skipping GPU tests" )
13
+ for item in items :
14
+ if "gpu" in item .keywords :
15
+ item .add_marker (skip_gpu )
You can’t perform that action at this time.
0 commit comments