MarketSquare / robotframework-aws

Custom Library for Robot Framework to interact with Amazon Cloud Services
MIT License
26 stars 21 forks source link

AttributeError: 'S3Keywords' object has no attribute 'logger' #40

Closed antigenius0910 closed 5 months ago

antigenius0910 commented 2 years ago

Hi,

Thanks for the awesome project once again! I am trying to try one of the test you have in test folder

*** Settings ***
Library  Collections
Library  AWSLibrary

*** Variable ***
${REGION}=  us-east-2
${BUCKET}=  infra-362-s3-nothing
${KEY}=  test_folder/test123
${PATH}=  /Users/yen/repo/devops/tools/aws/s3_MFA_unittest/test123

*** Test Case ***
Upload File
    Create Session With Keys  ${REGION}  ${ACCESS_KEY}  ${SECRET_KEY}
    Upload File  ${BUCKET}  ${KEY}  ${PATH} 
    Key Should Exist  ${BUCKET}  ${KEY}
    Delete File  ${BUCKET}  ${KEY}
    Delete All Sessions

but kept failing on below message

=============================================================================
S3                                                                            
==============================================================================
Upload File                                                           | FAIL |
AttributeError: 'S3Keywords' object has no attribute 'logger'
------------------------------------------------------------------------------
S3                                                                    | FAIL |
1 test, 0 passed, 1 failed
==============================================================================
Output:  /Users/yen/repo/devops/tools/aws/s3_MFA_unittest/output.xml
Log:     /Users/yen/repo/devops/tools/aws/s3_MFA_unittest/log.html
Report:  /Users/yen/repo/devops/tools/aws/s3_MFA_unittest/report.html

the file actually get uploaded but since the code fail then robotframwork report it as fail

and I wonder you have seeing this before? if not, do you know where I should start to troubleshoot? ᐅ python --version Python 3.8.11

This is what I got when I turn on debug

(Pdb) r
==============================================================================
S3                                                                            
==============================================================================
--Return--
> /usr/local/anaconda3/envs/devops3811/lib/python3.8/site-packages/robot/running/suiterunner.py(84)start_suite()->None
-> self._executed_tests = NormalizedDict(ignore='_')
(Pdb) r
> /usr/local/anaconda3/envs/devops3811/lib/python3.8/site-packages/robot/model/visitor.py(86)visit_suite()
-> suite.setup.visit(self)
(Pdb) r
Upload File                                                           | FAIL |
AttributeError: 'S3Keywords' object has no attribute 'logger'
------------------------------------------------------------------------------
S3                                                                    | FAIL |
1 test, 0 passed, 1 failed
==============================================================================
--Return--
> /usr/local/anaconda3/envs/devops3811/lib/python3.8/site-packages/robot/model/visitor.py(90)visit_suite()->None
-> self.end_suite(suite)
(Pdb) l
 85             if self.start_suite(suite) is not False:
 86                 suite.setup.visit(self)
 87                 suite.suites.visit(self)
 88                 suite.tests.visit(self)
 89                 suite.teardown.visit(self)
 90  ->             self.end_suite(suite)
 91     
 92         def start_suite(self, suite):
 93             """Called when suite starts. Default implementation does nothing.
 94     
 95             Can return explicit ``False`` to stop visiting.
(Pdb) 
rahul2july commented 2 years ago

There is a minor bug in the code. /AWSLibrary/keywords/s3.py #87 self.logger.info(response) -> self.rb_logger.info(response)

rahul2july commented 2 years ago

There are few more bugs here and there, will raise a PR shortly.

Gabriel-Repos commented 2 years ago

Hi!,

There is any news about a fix/PR for this bug?.

Thank you so much for this project!! Regards.