Note that square brackets are valid characters in filenames in majority of
filesystems (including ext and ntfs).
Steps to reproduce:
Set FIXTURE_DIRS in settings.py to anything containing square brackets,
e.g. `/home/user/test[123]`. Try to load any fixture from that directory
in your tests.py. It won't find it and will print a warning: `No fixture
named 'your_fixture_name' found.`
--
Ticket URL: <https://code.djangoproject.com/ticket/24978>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* component: Testing framework => Core (Management commands)
* needs_tests: => 0
* needs_docs: => 0
Comment:
Hi,
Indeed, I can reproduce that issue.
Python 3.4 gained a `glob.escape` function that we'll probably want to
backport in some way:
https://docs.python.org/3/library/glob.html#glob.escape.
Thanks
--
Ticket URL: <https://code.djangoproject.com/ticket/24978#comment:1>
* owner: nobody => MoritzS
* status: new => assigned
* has_patch: 0 => 1
Comment:
Added PR.
--
Ticket URL: <https://code.djangoproject.com/ticket/24978#comment:2>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"98df288ddaba9787e4a370f12aba51c2b9133142" 98df288]:
{{{
#!CommitTicketReference repository=""
revision="98df288ddaba9787e4a370f12aba51c2b9133142"
Fixed #24978 -- Escaped special characters in loaddata fixture paths
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24978#comment:3>
* status: closed => new
* has_patch: 1 => 0
* resolution: fixed =>
* easy: 1 => 0
Comment:
Sorry, but the new test doesn't pass on Windows. Are you able to
investigate?
--
Ticket URL: <https://code.djangoproject.com/ticket/24978#comment:4>
Comment (by Tim Graham <timograham@…>):
In [changeset:"81aae2884377ff1a60b74e510e3358738971bbc0" 81aae28]:
{{{
#!CommitTicketReference repository=""
revision="81aae2884377ff1a60b74e510e3358738971bbc0"
Refs #24978 -- Skipped an unsupported test on Windows.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24978#comment:5>
* status: new => closed
* resolution: => fixed
--
Ticket URL: <https://code.djangoproject.com/ticket/24978#comment:6>
Comment (by Gagaro):
"?" and "*" are invalid characters on Windows and thus the
"fixture?with[special]chars*.json" file cannot be created and cause issue
when cloning the repository.
Should I create a new ticket or reopen this one ?
--
Ticket URL: <https://code.djangoproject.com/ticket/24978#comment:7>
Comment (by bmispelon):
Replying to [comment:7 Gagaro]:
> Should I create a new ticket or reopen this one ?
I would open a new one.
Thanks.
--
Ticket URL: <https://code.djangoproject.com/ticket/24978#comment:8>
* status: closed => new
* resolution: fixed =>
Comment:
The fix for this one hasn't been released, so it's fine to reopen. I had
just skipped the test on Windows, but I guess if we can find characters
that work as a regression test but keep Windows happy, that solution would
be fine as well.
--
Ticket URL: <https://code.djangoproject.com/ticket/24978#comment:9>
Comment (by Gagaro):
"[" and "]" are enough for the regression test and works on Windows. I did
the fix and the pull request is there:
https://github.com/django/django/pull/4898
This pull request should be squashed with the other fix to avoid having
the bad file in the repository at all.
--
Ticket URL: <https://code.djangoproject.com/ticket/24978#comment:10>
Comment (by Tim Graham <timograham@…>):
In [changeset:"8b7bd62ae52313dbe96f27f21fbd63f0dd061744" 8b7bd62]:
{{{
#!CommitTicketReference repository=""
revision="8b7bd62ae52313dbe96f27f21fbd63f0dd061744"
Refs #24978 -- Amended test filename to avoid checkout warnings on
Windows.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24978#comment:11>
* status: new => closed
* resolution: => fixed
--
Ticket URL: <https://code.djangoproject.com/ticket/24978#comment:12>