File tree Expand file tree Collapse file tree 5 files changed +40
-5
lines changed
openrl/supports/opendata/utils
tests/test_supports/test_opendata Expand file tree Collapse file tree 5 files changed +40
-5
lines changed Original file line number Diff line number Diff line change 2727 - name : do_unittest
2828 timeout-minutes : 40
2929 run : |
30- pytest tests --cov=openrl --cov-report=xml -m unittest --cov-report=term-missing --durations=0 -v --color=yes
30+ python3 -m pytest tests --cov=openrl --cov-report=xml -m unittest --cov-report=term-missing --durations=0 -v --color=yes
3131 - name : Upload coverage reports to Codecov with GitHub Action
3232 uses : codecov/codecov-action@v3
3333 with :
Original file line number Diff line number Diff line change 1111[ ![ Code style: black] ( https://img.shields.io/badge/code%20style-black-000000.svg )] ( https://github.com/psf/black )
1212
1313[ ![ Hits-of-Code] ( https://hitsofcode.com/github/OpenRL-Lab/openrl?branch=main )] ( https://hitsofcode.com/github/OpenRL-Lab/openrl/view?branch=main )
14- [ ![ codecov] ( https://codecov.io/gh/OpenRL-Lab/openrl_release/branch/main/ graph/badge.svg?token=4FMEYMR83U )] ( https://codecov.io/gh/OpenRL-Lab/openrl_release )
14+ [ ![ codecov] ( https://codecov.io/gh/OpenRL-Lab/openrl/ graph/badge.svg?token=T6BqaTiT0l )] ( https://codecov.io/gh/OpenRL-Lab/openrl )
1515
1616[ ![ Documentation Status] ( https://readthedocs.org/projects/openrl-docs/badge/?version=latest )] ( https://openrl-docs.readthedocs.io/en/latest/?badge=latest )
1717[ ![ Read the Docs] ( https://img.shields.io/readthedocs/openrl-docs-zh?label=%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3 )] ( https://openrl-docs.readthedocs.io/zh/latest/ )
Original file line number Diff line number Diff line change 1212[ ![ Code style: black] ( https://img.shields.io/badge/code%20style-black-000000.svg )] ( https://github.com/psf/black )
1313
1414[ ![ Hits-of-Code] ( https://hitsofcode.com/github/OpenRL-Lab/openrl?branch=main )] ( https://hitsofcode.com/github/OpenRL-Lab/openrl/view?branch=main )
15- [ ![ codecov] ( https://codecov.io/gh/OpenRL-Lab/openrl/branch/main/ graph/badge.svg?token=T6BqaTiT0l )] ( https://codecov.io/gh/OpenRL-Lab/openrl )
15+ [ ![ codecov] ( https://codecov.io/gh/OpenRL-Lab/openrl/graph/badge.svg?token=T6BqaTiT0l )] ( https://codecov.io/gh/OpenRL-Lab/openrl )
1616
1717[ ![ Documentation Status] ( https://readthedocs.org/projects/openrl-docs/badge/?version=latest )] ( https://openrl-docs.readthedocs.io/zh/latest/?badge=latest )
1818[ ![ Read the Docs] ( https://img.shields.io/readthedocs/openrl-docs-zh?label=%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3 )] ( https://openrl-docs.readthedocs.io/zh/latest/ )
Original file line number Diff line number Diff line change 1919from pathlib import Path
2020from typing import Optional
2121
22- from datasets import load_from_disk
23-
2422
2523def data_abs_path (path : str , data_server_dir : Optional [str ] = None ) -> str :
2624 if "data_server://" in path :
@@ -49,6 +47,7 @@ def data_server_wrapper(fp):
4947
5048
5149def load_dataset (data_path : str , split : str ):
50+ from datasets import load_from_disk
5251 if Path (data_path ).exists ():
5352 dataset = load_from_disk ("{}/{}" .format (data_path , split ))
5453 elif "data_server:" in data_path :
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+ # -*- coding: utf-8 -*-
3+ # Copyright 2023 The OpenRL Authors.
4+ #
5+ # Licensed under the Apache License, Version 2.0 (the "License");
6+ # you may not use this file except in compliance with the License.
7+ # You may obtain a copy of the License at
8+ #
9+ # https://www.apache.org/licenses/LICENSE-2.0
10+ #
11+ # Unless required by applicable law or agreed to in writing, software
12+ # distributed under the License is distributed on an "AS IS" BASIS,
13+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ # See the License for the specific language governing permissions and
15+ # limitations under the License.
16+
17+ """"""
18+
19+ import os
20+ import sys
21+
22+ import pytest
23+
24+ from openrl .supports .opendata .utils .opendata_utils import data_abs_path
25+
26+
27+ @pytest .mark .unittest
28+ def test_data_abs_path ():
29+ data_path = "./"
30+ assert data_abs_path (data_path ) == data_path
31+
32+
33+
34+
35+ if __name__ == "__main__" :
36+ sys .exit (pytest .main (["-sv" , os .path .basename (__file__ )]))
You can’t perform that action at this time.
0 commit comments