petl-developers / petl

Python Extract Transform and Load Tables of Data
MIT License
1.22k stars 190 forks source link

Migrate to pytest #584

Closed arturponinski closed 2 years ago

arturponinski commented 2 years ago

This PR has the objective of migrating the current nosetest runner to pytest. Successfully ran the whole test suite against py3.8 with the exception of bcolz. This the minimal effort and test suite code change required to use pytest.

Changes

  1. The existing conditional checks have been rewritten / added to conform with pytest assertions
  2. Expected exceptions rewritten to use .raises
  3. Tests to be skipped are skipped using pytest
  4. Additionally a fix to close the opened connections in _iter_sqlalchemy_engine has been commited

Checklist

Checklist for for pull requests including new code and/or changes to existing code...

coveralls commented 2 years ago

Coverage Status

Coverage decreased (-0.2%) to 90.871% when pulling 388ee4a0062cab2af91f8a9a843a12a58b41cc2a on arturponinski:migrate-to-pytest into c29120ec5fd871d7a0553e5a3435b62b40cca665 on petl-developers:master.

arturponinski commented 2 years ago

@juarezr could you give me a hand regarding failing Codacy Security Scan ?

juarezr commented 2 years ago

@juarezr could you give me a hand regarding failing Codacy Security Scan ?

Missed your message.

The failure is not related with your changes. As your code does not change runtime code, it's safe to assume that we are not spreading any security issue in the released package.

Probably the check did break because of some random reason. It should be running even independently of any other changes.

arturponinski commented 2 years ago

Glad to hear that, and some nice catches from you! I think it is good to go now. After the merge, work on reducing code duplicates, using pytest goodies like fixtures can slowly begin - I could start with splitting test_db_server, it can be nicely split per library with some common parts shared among test clasess.

juarezr commented 2 years ago

@arturponinski,

Nice job!