Running CKAN core tests -


i'm trying run ckan tests , ain't working.

my config (local docker setup, credentials showing fine) @ https://gist.github.com/lwm/cd33556fb18d9b8395209cb6233d75af.

i'm quite sure postgresql, redis , solr set correctly.

i can see these tests passing on ckan head, i'm pretty stumped.

here's test logs:

(default)root@b13dc1f03f32:/usr/lib/ckan/default/src/ckan# nosetests --with-pylons=$ckan_ini -x 2017-09-12 08:38:39,831 info  [ckan.config.environment] loading static files public 2017-09-12 08:38:39,860 info  [ckan.config.environment] loading templates /usr/lib/ckan/default/src/ckan/ckan/templates 2017-09-12 08:38:40,044 info  [ckan.config.environment] loading templates /usr/lib/ckan/default/src/ckan/ckan/templates 2017-09-12 08:38:40,158 info  [ckan.model] database tables created 2017-09-12 08:38:40,158 info  [ckan.websetup] creating tables: success .2017-09-12 08:38:40,958 info  [ckan.config.environment] loading templates /usr/lib/ckan/default/src/ckan/ckan/templates f ====================================================================== fail: ckan.tests.config.test_environment.testsiteurlmandatory.test_missing_siteurl ---------------------------------------------------------------------- traceback (most recent call last):   file "/usr/lib/ckan/default/local/lib/python2.7/site-packages/nose/case.py", line 197, in runtest     self.test(*self.arg)   file "/usr/lib/ckan/default/src/ckan/ckan/tests/helpers.py", line 389, in wrapper     return func(*args, **kwargs)   file "/usr/lib/ckan/default/src/ckan/ckan/tests/config/test_environment.py", line 90, in test_missing_siteurl     nosetools.assert_raises(runtimeerror, environment.update_config) assertionerror: runtimeerror not raised  ---------------------------------------------------------------------- ran 2 tests in 1.564s  failed (failures=1) 

any pointers appreciated!

some ckan configuration options can set via environment variables, instance when running docker container.

these particular tests don't take account , check if site url set directly in config object, that's why pass in local install , fail inside container.

to make them more robust need make them ignore setting environment variable:

diff --git a/ckan/tests/config/test_environment.py b/ckan/tests/config/test_environment.py index fafe701..16f1895 100644 --- a/ckan/tests/config/test_environment.py +++ b/ckan/tests/config/test_environment.py @@ -85,6 +85,15 @@ class testupdateconfig(h.functionaltestbase):   class testsiteurlmandatory(object):  +    @classmethod +    def setup_class(cls): +        cls._site_url_from_env_var = os.environ.pop('ckan_site_url', none) + +    @classmethod +    def teardown_class(cls): +        if cls._site_url_from_env_var: +            os.environ['ckan_site_url'] = cls._site_url_from_env_var +      @helpers.change_config('ckan.site_url', '')      def test_missing_siteurl(self):          nosetools.assert_raises(runtimeerror, environment.update_config) 

feel free submit pull request improve tests upstream.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -