SetCulture broken with 2.5.4

Bug #561436 reported by Pascal Berger
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
NUnit Framework
Fix Released
High
Charlie Poole
NUnit V2
Fix Released
High
Charlie Poole

Bug Description

I've several test cases with the SetCulture attribute set on it. Since update to NUnit 2.5.4 these test cases are always run with "en" culture instead of the one provided by the SetCulture attribute (same behaviour in Gui and Console)

Revision history for this message
Charlie Poole (charlie.poole) wrote :

Hmmm... this is a bit of a mystery, since NUnit's own tests of SetCultureAttribute are passing - at least for me.

To clarify the issue, here are a few things to try...

1) Do NUnit's tests all pass for you?

2) Take a look at our tests at http://bazaar.launchpad.net/~nunit-core/nunitv2/2.5.3/annotate/head%3A/src/NUnitCore/tests/CultureSettingAndDetectionTests.cs Is there some use case we are missing?

3) Can you post a simple test that reproduces the error?

Thanks for the report

Charlie

Revision history for this message
Pascal Berger (pascal-berger) wrote :

1) Yes the relevant tests pass (but some other fail, but I haven't looked into them)
3) Try something like this. With 2.5.3 this enforces "de" culture, with 2.5.4 it formats the date in the culture of the os:

Imports NUnit.Framework

<TestFixture()> _
Public Class Class1

    <TestCase(Result:="01.06.2010 00:00:00")> _
    <SetCulture("de-DE")> _
    Public Function TestFormatBbtDateTimeDeDE() As String
        Return New DateTime(2010, 6, 1).ToString()
    End Function

End Class

Revision history for this message
Charlie Poole (charlie.poole) wrote :

Good catch! This seems to be unique to the situation in which SetCultureAttribute is specified on the method and there are multiple test cases. NUnit had no tests for that combination. I wonder if this applies to any other attributes...

Changed in nunitv2:
status: New → Confirmed
milestone: none → 2.5.5
Revision history for this message
Charlie Poole (charlie.poole) wrote :

Found the cause... setting culture was incorporated into DoOneTimeSetUp, which is bypassed by parameterized fixtures. It doesn't really belong there.

The good news: this won't affect any other attributes.

Changed in nunitv2:
assignee: nobody → Charlie Poole (charlie.poole)
importance: Undecided → High
Revision history for this message
Charlie Poole (charlie.poole) wrote :

Marking this as affecting NUnit 3.0 so that we remember to check it. The code may actually be different.

Changed in nunitv2:
status: Confirmed → In Progress
Changed in nunitv2:
status: In Progress → Fix Committed
Changed in nunit-3.0:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Charlie Poole (charlie.poole)
milestone: none → 2.9.4
Changed in nunit-3.0:
status: Triaged → Fix Committed
Changed in nunitv2:
status: Fix Committed → Fix Released
Changed in nunit-3.0:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.