drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vvysotskyi <...@git.apache.org>
Subject [GitHub] drill pull request #904: DRILL-5717: let some date time test cases be Local ...
Date Mon, 21 Aug 2017 15:37:28 GMT
Github user vvysotskyi commented on a diff in the pull request:

    https://github.com/apache/drill/pull/904#discussion_r134259055
  
    --- Diff: exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestDateFunctions.java
---
    @@ -43,6 +46,11 @@
     public class TestDateFunctions extends PopUnitTestBase {
         static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestDateFunctions.class);
     
    +    @BeforeClass
    +    public static void setupLocal() {
    +        Locale.setDefault(new Locale("en", "US"));
    --- End diff --
    
    This change also affects other unit tests which will be executed after the tests in this
class. 
    So to avoid this, for each unit test which depends on the locale, we should:
    1. preserve current locale
    2. change locale to "en"
    3. execute test (in the try block)
    4. restore locale (in the finally block).
    
    As the example, you may use test testConstantFolding_allTypes() from the class TestConstantFolding
below.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message