Skip to content

Commit

Permalink
make it a fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
f4hy committed Aug 8, 2020
1 parent eec7495 commit 9b8686b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/trainer/test_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -990,16 +990,19 @@ def setup(self, stage):
assert trainer.get_model().stage == 'test'


def test_trainer_ensure_no_local_only_file_ops(tmpdir, monkeypatch):
@pytest.fixture
def no_local_file_ops(monkeypatch):
monkeypatch.delattr(os.path, "exists")
monkeypatch.delattr(os.path, "isdir")


def test_trainer_ensure_no_local_only_file_ops(tmpdir, monkeypatch, no_local_file_ops):
"""Currently file ops use helpers in cloud_io to ensure thigns work with local or remote files
We will monkeypatch to disable some problematic local only methods to
hopefully prevent any file ops from being added which only work locally """

monkeypatch.setenv('TORCH_HOME', str(tmpdir))
monkeypatch.delattr(os.path, "exists")
monkeypatch.delattr(os.path, "isdir")
monkeypatch.delattr(os.path, "isfile")

model = EvalModelTemplate()

Expand Down

0 comments on commit 9b8686b

Please sign in to comment.