Opened 10 years ago

Last modified 10 years ago

#23612 closed Bug

Relative fixture paths not working on Windows 8.1 — at Version 1

Reported by: Brandon Taylor Owned by: nobody
Component: Testing framework Version: dev
Severity: Normal Keywords: windows fixtures
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Simon Charette)

I have a Django 1.6.6 project that is not loading fixtures from relative paths using Python 2.7.8 on Windows 8.1. Works just fine in Linux.

Example Test Case:

# cart/tests.py

class CartTestBase(TestCase):
    fixtures = ['products/fixtures/product_categories.json',
    'products/fixtures/brands.json', 'products/fixtures/products.json']

Which fits into a directory structure of:

ecomm_app/
    cart/
        __init__.py
        models.py
        tests.py
        . . .
      
    products/
        fixtures/
            products/fixtures/product_categories.json
            products/fixtures/brands.json
            products/fixtures/products.json
        __init__.py
        models.py
        . . .

The specific error message is:

UserWarning: No fixture named 'products/fixtures/products' found.
warnings.warn("No fixture named '%s' found." % fixture_name)

The corresponding app modules are listed in INSTALLED_APPS and work fine otherwise. Specifying an absolute path does work, but obviously isn't cross-platform. Specifying a root-relative path does not work, e.g.: /products/fixtures/brands.json

Moving the fixtures to /cart/fixtures/ and referencing them by name only works.

Change History (1)

comment:1 by Simon Charette, 10 years ago

Description: modified (diff)

First I assume the files in products/fixtures/ are named <name>.json and not products/fixtures/<name>.json.

I don't have Windows VM at hand but isn't it using backslashes (\) as directory separators?

Note: See TracTickets for help on using tickets.
Back to Top