That the directory containing the source is writable may be true for the
moment but is probably a bad assumption going forward. Other tests use the
tempfile module for this sort of thing (though here its simpler to just
generate in memory).
On Apr 2, 2014 1:38 PM, "Ian Goodfellow" <notifications@github.com> wrote:

> In pylearn2/train_extensions/tests/test_roc_auc.py:
>
> > +from pylearn2.config import yaml_parse
> > +import numpy as np
> > +import unittest
> > +import cPickle
> > +import os
> > +
> > +
> > +class TestROCAUCChannel(unittest.TestCase):
> > +    """Train a simple model and calculate ROC AUC for monitoring datasets."""
> > +    def setUp(self):
> > +        skip_if_no_sklearn()
> > +        for name in ['train', 'valid', 'test']:
> > +            X = np.random.random((1000, 15))
> > +            y = np.random.randint(2, size=1000)
> > +            dataset = DenseDesignMatrix(X=X, y=y)
> > +            dataset.convert_to_one_hot()
>
> This will crash if the user runs nosetests from a directory where they
> don't have write permissions. There are two ways around this.
>
> The easier one is to just write a function that generates the data and
> call it with an !obj tag instead of loading the dataset from a !pkl tag.
>
> The slightly more involved way is to put your .pkl files in the same
> directory as the test:
>
> directory = os.path.split(os.path.realpath(__file__))[0]
> path = os.path.join(directory, "{}_dataset.pkl".format(name))
>
> and then dump to path.
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/lisa-lab/pylearn2/pull/766/files#r11217257>
> .
>