Skip to content

Conversation

@Qingtang-SDK
Copy link
Contributor

No description provided.


class NewEndpointTest(SDKTestBase):

def setUp(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是不是应该有个对应的 tearDown

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不用,没有环境需要销毁。tearDown多数情况下是为了防止影响以后的测试,或者释放资源。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果后续有 testcase 增加的时候 可能会踩到这个坑。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DefaultEndpointResolver.predefined_endpoint_resolver = UserCustomizedEndpointResolver()
这个语句的作用是将 DefaultEndpointResolver 恢复到初始状态。应该不会有任何一个测试用例依赖其他case运行后的状态。


cd -
coverage run --branch -m pytest ./
coverage run --branch -m unittest2 discover -s . -p "*_test.py"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unittest2 是给 python2.6 用的。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unittest2 is a backport of the new features added to the unittest testing framework in Python 2.7 and onwards. It is tested to run on Python 2.6, 2.7, 3.2, 3.3, 3.4 and pypy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已经设置仅在2.6中使用unittest2

Copy link
Contributor

@JacksonTian JacksonTian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unittest2 应该是不对的。

@codecov-io
Copy link

codecov-io commented Jan 4, 2019

Codecov Report

Merging #160 into master will increase coverage by 0.07%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #160      +/-   ##
==========================================
+ Coverage   89.52%   89.59%   +0.07%     
==========================================
  Files          66       66              
  Lines        2921     2922       +1     
  Branches      212      212              
==========================================
+ Hits         2615     2618       +3     
+ Misses        285      284       -1     
+ Partials       21       20       -1
Impacted Files Coverage Δ
.../aliyunsdkcore/auth/signers/ram_role_arn_signer.py 98.24% <100%> (+0.03%) ⬆️
aliyun-python-sdk-core/aliyunsdkcore/compat.py 57.57% <0%> (+6.06%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bbfdadb...665a287. Read the comment docs.

@JacksonTian JacksonTian merged commit a2c5fe6 into master Jan 4, 2019
@JacksonTian JacksonTian deleted the fix_tests.haowei branch May 13, 2020 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants