Skip to content
This repository was archived by the owner on Aug 29, 2019. It is now read-only.

Conversation

@mdruger
Copy link

@mdruger mdruger commented Feb 14, 2014

This is the start of an iteration for updating code to current formatting standards.
Also, replace dingus module with mock module.

Testing:
run in virtualenv
$ python setup.py nosetests

@JohnBrodie
Copy link

Dingus is still installed, but mock is not (see setup.py and tox.ini).

@JohnBrodie
Copy link

The test coverage here has a few holes in it.

Choose a reason for hiding this comment

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

trailing comma

@JohnBrodie
Copy link

There are still a bunch of bare asserts mixed in with unittest2 assertions, the bare asserts should be changed.

@JohnBrodie
Copy link

➜  AWeber-API-Python-Library git:(test-code-std-update) ✗ pep8 tests/*.py
zsh: /usr/bin/pep8: bad interpreter: /Volumes/aweber/github/salesforce-data-sync/bin/python: no such file or directory
tests/test_aweber_collection.py:50:28: E712 comparison to False should be 'if cond is not False:' or 'if cond:'
tests/test_aweber_collection.py:101:51: E712 comparison to True should be 'if cond is True:' or 'if cond:'
tests/test_aweber_entry.py:106:28: E712 comparison to False should be 'if cond is not False:' or 'if cond:'
tests/test_aweber_entry.py:171:46: E203 whitespace before ','
tests/test_aweber_entry.py:182:45: E203 whitespace before ','
tests/test_aweber_entry.py:183:13: E128 continuation line under-indented for visual indent
tests/test_aweber_entry.py:216:41: E203 whitespace before ','

@JohnBrodie
Copy link

Looks like we dislike super in the tests as well for some reason, we should change that.

@JohnBrodie
Copy link

It looks like many of the tests could easily be switched to use setUpClass instead of setUp to minimize the setup/teardown time in the tests.

@JohnBrodie
Copy link

There are still backslashes used in files like test_aweber_collection that should go away.

@JohnBrodie
Copy link

So, if we want to bring the tests in line with what we would consider our "modern" codebase, there is a lot more work to be done here than just syntax fixes.

The lowest hanging fruit would be things like:

class AWeberAPITest(TestCase):

    def setUp(self):
        self.aweber = AWeberAPI(key, secret)

    def test_should_exist(self):
        self.assertTrue(self.aweber)

But these tests are a mix of broad unit-tests and heavily mocked integration tests. That would have to be fixed... Much of the tests would essentially have to be rewritten. That's likely more work than we want to do?

@JohnBrodie
Copy link

I'll also mention code coverage again. Instead of saying "install this in a venv" in the README, it'd be great if there were a simple Makefile with a few targets....

@JohnBrodie
Copy link

Tests fail locally on on Travis due to import issues.

@JohnBrodie
Copy link

This will need to be rebased.

@ghost
Copy link

ghost commented Mar 10, 2014

This needs to be rebased off of the most version of master.

Mike Druger added 10 commits March 10, 2014 15:35
update code standards
replace dingus module with mock module.
PPACL-4 remove dingus, add Mock in tox.
remove Dingus and add Mock library.
update code stds for mock_adaptor
updated base tests to match code std
update entry test to code std.
update tdata_dict test code to std.
add correct unittest module

Choose a reason for hiding this comment

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

Are either of these methods ever used?

Copy link
Author

Choose a reason for hiding this comment

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

removed.

Choose a reason for hiding this comment

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

these comments should be removed

Copy link
Author

Choose a reason for hiding this comment

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

removed.

@pianoman19372
Copy link

i ran pep8, the 2 whitespace checks chris remarked show there.

i also ran pylint, and found these errors:
4 cases: Catching too general exception Exception
3 cases: Dangerous default value {} as argument
1 case: Redefining built-in 'file'
2 case: Redefining built-in 'list'

Unused variables and arguments: could be ok, just verify that these are a result of a mock, instead of a helper function

Docstrings are not required in most test functions, but if you wrote a helper method it should have a docstring. verify that all helper methods have docstrings.
mock_adapter.py:1: [C] Missing docstring

miked: I ran pylint and pep 8 on all files. verified that the pertinent warning messages were addressed.
I fixed all that is highlighted above. However, the Missing docstring in the mock_adaptor.py file as well as other files reported does not apply. Verified that helper functions had docstrings, but there are no helper functions in the tests.

Mike Druger added 7 commits March 21, 2014 15:23
setup to find functional test dir
update mock_adapter to code std
update code standards for collection
code std update for aweber_api
update code std for aweber_entry
update code std for data_dict
move existing tests to new dir
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants