Skip to content

Commit

Permalink
Use tmpdir fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Virshup committed May 19, 2017
1 parent d9d2398 commit 2cd7d14
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions pyccc/tests/test_file_refs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: UTF-8 -*-
import os
import sys
import pickle
import pytest
Expand Down Expand Up @@ -30,10 +31,6 @@ def fixture_wrapper(func):
'1234']


def _gen_tempfile_path():
return '/tmp/pyccc_test_%s.txt' % uuid.uuid4()


@typedfixture('container')
def bytescontainer():
return pyccc.files.BytesContainer(BYTES_CONTENT)
Expand All @@ -45,18 +42,18 @@ def stringcontainer():


@typedfixture('container')
def localfile_from_bytes(bytescontainer):
return bytescontainer.put(_gen_tempfile_path())
def localfile_from_bytes(bytescontainer, tmpdir):
return bytescontainer.put(os.path.join(str(tmpdir), 'bytesfile'))


@typedfixture('container')
def localfile_from_string(stringcontainer):
return stringcontainer.put(_gen_tempfile_path())
def localfile_from_string(stringcontainer, tmpdir):
return stringcontainer.put(os.path.join(str(tmpdir), 'strfile'))


@typedfixture('container')
def localfile_in_memory(bytescontainer):
localfile = bytescontainer.put(_gen_tempfile_path())
def localfile_in_memory(bytescontainer, tmpdir):
localfile = bytescontainer.put(os.path.join(str(tmpdir), 'bytefile'))
return pyccc.FileContainer(localfile.localpath)


Expand Down

0 comments on commit 2cd7d14

Please sign in to comment.