[ 
https://issues.apache.org/jira/browse/IMPALA-14174?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Csaba Ringhofer updated IMPALA-14174:
-------------------------------------
    Description: 
.cls and .self are often used interchangeably in subclasses of ImpalaTestSuite, 
which can get confusing, e.g  
https://gerrit.cloudera.org/#/c/22527/23/tests/metadata/test_event_processing_base.py

A reason is that many initialization logic happens in 
ImpalaTestSuite/CustomClusterTestSuite's setup_class, which can only use class 
methods, but some of these class methods are also used during per test method 
initialization, where instance methods would be more suitable. An example is 
cluster_setup() 
https://github.com/apache/impala/blob/892b33f35d1cab01d91d9b5eaac079ec8ba236bb/tests/common/custom_cluster_test_suite.py#L268

class and instance variables as not differentiated in naming but have different 
subclass semantics, e.g CustomClusterTestSuite.my_var = 1 won't be visible when 
someone asks for ImpalaTestSuite.my_var

Note that the classic pytest answer would be "don't use any of those, use 
fixtures", but turning some of these members (clients, cluster abstraction) 
into fixtures would be a massive refactor and may make the code more noisy.

  was:
.cls and .self are often used interchangeably in subclasses of ImpalaTestSuite, 
which can get confusing, e.g  
https://gerrit.cloudera.org/#/c/22527/23/tests/metadata/test_event_processing_base.py

A reason is that many initialization logic happens in 
ImpalaTestSuite/CustomClusterTestSuite's setup_class, which can only use class 
methods, but some of these class methods are also used during per test method 
initialization, where instance methods would be more suitable. An example is 
cluster_setup() 
https://github.com/apache/impala/blob/892b33f35d1cab01d91d9b5eaac079ec8ba236bb/tests/common/custom_cluster_test_suite.py#L268

class and instance variables as not differentiated in naming but have different 
subclass semantics, e.g CustomClusterTestSuite.my_var = 1 won't be visible when 
someone asks for ImpalaTestSuite.my_var


> Clean up class vs instance handling in Impala EE tests
> ------------------------------------------------------
>
>                 Key: IMPALA-14174
>                 URL: https://issues.apache.org/jira/browse/IMPALA-14174
>             Project: IMPALA
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Csaba Ringhofer
>            Priority: Minor
>
> .cls and .self are often used interchangeably in subclasses of 
> ImpalaTestSuite, which can get confusing, e.g  
> https://gerrit.cloudera.org/#/c/22527/23/tests/metadata/test_event_processing_base.py
> A reason is that many initialization logic happens in 
> ImpalaTestSuite/CustomClusterTestSuite's setup_class, which can only use 
> class methods, but some of these class methods are also used during per test 
> method initialization, where instance methods would be more suitable. An 
> example is cluster_setup() 
> https://github.com/apache/impala/blob/892b33f35d1cab01d91d9b5eaac079ec8ba236bb/tests/common/custom_cluster_test_suite.py#L268
> class and instance variables as not differentiated in naming but have 
> different subclass semantics, e.g CustomClusterTestSuite.my_var = 1 won't be 
> visible when someone asks for ImpalaTestSuite.my_var
> Note that the classic pytest answer would be "don't use any of those, use 
> fixtures", but turning some of these members (clients, cluster abstraction) 
> into fixtures would be a massive refactor and may make the code more noisy.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to