Browse Source

1. 为test_paddle_utils添加paddle标签;2.修改test_set_backend测试例适应没有conda的情况

tags/v1.0.0alpha
x54-729 2 years ago
parent
commit
e9bc2bf4a6
2 changed files with 10 additions and 5 deletions
  1. +1
    -0
      tests/core/utils/test_paddle_utils.py
  2. +9
    -5
      tests/envs/test_set_backend.py

+ 1
- 0
tests/core/utils/test_paddle_utils.py View File

@@ -64,6 +64,7 @@ class TestPaddleToDevice:
#
############################################################################

@pytest.mark.paddle
class TestPaddleMoveDataToDevice:

def check_gpu(self, tensor, idx):


+ 9
- 5
tests/envs/test_set_backend.py View File

@@ -9,10 +9,14 @@ from fastNLP.envs.distributed import rank_zero_rm
def test_dump_fastnlp_envs():
filepath = None
try:
with Capturing() as output:
dump_fastnlp_backend(backend="torch")
filepath = os.path.join(os.path.expanduser('~'), '.fastNLP', 'envs', os.environ['CONDA_DEFAULT_ENV']+'.json')
assert filepath in output[0]
assert os.path.exists(filepath)
if 'CONDA_DEFAULT_ENV' in os.environ:
with Capturing() as output:
dump_fastnlp_backend(backend="torch")
filepath = os.path.join(os.path.expanduser('~'), '.fastNLP', 'envs', os.environ['CONDA_DEFAULT_ENV']+'.json')
assert filepath in output[0]
assert os.path.exists(filepath)
else:
with pytest.raises(RuntimeError):
dump_fastnlp_backend(backend="torch")
finally:
rank_zero_rm(filepath)

Loading…
Cancel
Save