jphalip / django-treemenus

A simple django app to manage navigation menus via the django admin
BSD 3-Clause "New" or "Revised" License
127 stars 58 forks source link

testing treemenus in a project #2

Open feuervogel opened 14 years ago

feuervogel commented 14 years ago

hi,

I'm using the github-version of treemenus in my django project and want to run the tests in context of the project. to make it short: it doesn't work. long story:

1st. not having added "treemenus.tests.fake_menu_extension", to the installed_apps I get:

Error: Database test_bb couldn't be flushed. Possible reasons:

  • The database isn't running or isn't configured correctly.
    • At least one of the expected database tables doesn't exist.
    • The SQL was invalid. Hint: Look at the output of 'django-admin.py sqlflush'. That's the SQL this command wasn't able to run. The full error: (1146, "Table 'test_bb.fake_menu_extension_fakemenuitemextension' doesn't exist")

twice. so I actually add "treemenus.tests.fake_menu_extension", to my installed apps, which leads to the 2nd situation:

2nd. I'm using custom templates using the url-tag referring to some urls of my project. the problem is, obviously you are using your own testing-urls and you are modifying the settings at runtime. so my tests don't pass but give me errors like:

TemplateSyntaxError: Caught NoReverseMatch while rendering: Reverse for 'home' with arguments '()' and keyword arguments '{}' not found.

solution: please use the setup's test_suite option, as seen in http://github.com/alex/django-taggit/blob/master/setup.py for example.

jphalip commented 14 years ago

Thanks for reporting this issue and posting a fix. May I ask which database you're using (postgres, sqlite, etc.) when those test fail?

feuervogel commented 14 years ago

i'm using sqlite for testing.

jphalip commented 13 years ago

I'm afraid I can't reproduce the issues you're reporting here. I've tried with sqlite and all tests pass...

artscoop commented 12 years ago

Same problem, using Django 1.3.1 and PostgreSQL (Psycopg 2.4.1 since 2.4.2 is broken with Django 1.3.x)

ramonrxven commented 9 years ago

hi, in django 1.6 treemenus work fine, but i'm upgrade to django 1.8 and had this error: Django Version: 1.8 Exception Type: ImportError Exception Value:

cannot import name TOKEN_BLOCK Exception Location: /local/lib/python2.7/site-packages/treemenus/templatetags/tree_menu_tags.py in render, line 63

regards

jphalip commented 9 years ago

@ramonrxven I suppose this is a separate issue. Could you create a separate ticket?