Skip to content

Commit

Permalink
Fixes iuploader test, running locally
Browse files Browse the repository at this point in the history
I was getting this:

    $ nosetests --nologcapture --with-pylons=test-core.ini -v ckanext/example_iuploader/test/test_plugin.py:TestExampleIUploaderPlugin.test_resource_download_iuploader_called
    ...
    OSError: [Errno 13] Permission denied: '/doesnt_exist'
  • Loading branch information
David Read committed Jul 12, 2019
1 parent 51e4130 commit 31a9c86
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions ckanext/example_iuploader/test/test_plugin.py
Expand Up @@ -45,12 +45,6 @@ def _get_package_new_page(app):


class TestExampleIUploaderPlugin(helpers.FunctionalTestBase):
def __init__(self):
super(TestExampleIUploaderPlugin, self).__init__()
self.fs = None
self.fake_open = None
self.fake_os = None

@classmethod
def setup_class(cls):
super(TestExampleIUploaderPlugin, cls).setup_class()
Expand All @@ -64,11 +58,15 @@ def teardown_class(cls):
@classmethod
def _apply_config_changes(cls, cfg):
cfg['ckan.storage_path'] = '/doesnt_exist'
# Note: webassets needs somewhere on disk to cache assets, however it
# is really hard to patch it to use the fake disk, so we simply let it
# write files to the real disk. Therefore /tmp must exist.
cfg['ckan.webassets.path'] = '/tmp/webassets'

def setup(self):
# Set up a fake filesystem for the uploads to be stored
super(TestExampleIUploaderPlugin, self).setup()

# Uses a fake filesystem for the uploads to be stored.
# Set up a mock open which tries the real filesystem first then falls
# back to the mock filesystem.
# Would be nicer if we could mock open on a specific module, but because
Expand Down

0 comments on commit 31a9c86

Please sign in to comment.