Browse Source

禁止travis测试非 test之外的文件

tags/v0.4.10
yh 5 years ago
parent
commit
e40447cc84
3 changed files with 5 additions and 3 deletions
  1. +1
    -1
      .travis.yml
  2. +3
    -1
      test/core/test_callbacks.py
  3. +1
    -1
      test/core/test_utils.py

+ 1
- 1
.travis.yml View File

@@ -8,7 +8,7 @@ install:
- pip install pytest-cov
# command to run tests
script:
- pytest --cov=./
- pytest --cov=./ test/

after_success:
- bash <(curl -s https://codecov.io/bash)

+ 3
- 1
test/core/test_callbacks.py View File

@@ -12,6 +12,7 @@ from fastNLP import AccuracyMetric
from fastNLP import SGD
from fastNLP import Trainer
from fastNLP.models.base_model import NaiveClassifier
from fastNLP.core.callback import EarlyStopError


def prepare_env():
@@ -65,7 +66,8 @@ class TestCallback(unittest.TestCase):
dev_data=data_set,
metrics=AccuracyMetric(pred="predict", target="y"),
callbacks=[EarlyStopCallback(5)])
trainer.train()
with self.assertRaises(EarlyStopError):
trainer.train()
def test_lr_scheduler(self):
data_set, model = prepare_env()


+ 1
- 1
test/core/test_utils.py View File

@@ -18,7 +18,7 @@ class Model(nn.Module):
self.param = nn.Parameter(torch.zeros(0))


class TestMoveModelDeivce(unittest.TestCase):
class TestMoveModelDevice(unittest.TestCase):
def test_case1(self):
# 测试str
model = Model()


Loading…
Cancel
Save