Thanks to visit codestin.com
Credit goes to github.com

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

added support for python 2.6.6 #443

Closed
wants to merge 27 commits into from
Closed

Conversation

eorochena
Copy link

fixing flake8/pep8 issues

fixing flake8/pep8 issues again

travis for Python 2.6

fixing AttributeError on python 2.6.9

pep8

pep8

travis checks for 2.6.x

unittest for travis checks for 2.6.x

passing travis tests 2.7 - forward

implemented changes suggested by @xginn8

copied requirements and init.py from upstream

Added back the AttributeError exception

Added back the AttributeError exception and included datetime

removed comment

h0bot and others added 3 commits May 1, 2017 20:20
... due to an uninitialized data variable.
fixing flake8/pep8 issues

fixing flake8/pep8 issues again

travis for Python 2.6

fixing AttributeError on python 2.6.9

pep8

pep8

travis checks for 2.6.x

unittest for travis checks for 2.6.x

passing travis tests 2.7 - forward

implemented changes suggested by @xginn8

copied requirements and __init__.py from upstream

Added back the AttributeError exception

Added back the AttributeError exception and included datetime

removed comment
pep8
@eorochena
Copy link
Author

Corrected issues with previous pull request.

@aviau
Copy link
Collaborator

aviau commented Jun 3, 2017

nice! <3

Can we add 2.6 tests on travis?

@sebito91
Copy link
Contributor

sebito91 commented Jul 6, 2017

Can you please rebase against existing master and ensure this check passes the new set of tests? Also, can you please squash these commits into one?

@aviau UPDATE REQUESTED

@sebito91
Copy link
Contributor

@eorochena, any chance you'd be able to rebase + add a test or two for py2.6.6? We can add this into the travis CI

@eorochena
Copy link
Author

Sorry, I was a little busy, I'll see what I can do to make this happen.

@sebito91 sebito91 self-assigned this Aug 15, 2017
@sebito91 sebito91 self-requested a review August 15, 2017 21:51
Copy link
Contributor

@sebito91 sebito91 left a comment

Choose a reason for hiding this comment

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

Rebase and retest please!

@eorochena
Copy link
Author

finally updated branch, sorry for the delay

@sebito91
Copy link
Contributor

That's fine, thanks for updating. Would you mind please adding a test case to your PR for python v2.6.6 to ensure everything passes?

@eorochena
Copy link
Author

For some reason Travis CI keeps failing with

ERROR: InvocationError: '/home/travis/build/influxdata/influxdb-python/.tox/py27/bin/nosetests -v --with-doctest'

I can't pinpoint where the actual error is

Copy link
Contributor

@sebito91 sebito91 left a comment

Choose a reason for hiding this comment

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

Couple of things, will look into the travis issues and reply separately.

Thanks for adding the updates!

@@ -0,0 +1,57 @@
#!/usr/bin/python
Copy link
Contributor

Choose a reason for hiding this comment

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

You should change this to #!/usr/bin/env python otherwise this might not use the correct version.

influxdb_server = "localhost"
port = 8086
database_name = "test_db"
ip_addr = os.popen("hostname").read()
Copy link
Contributor

Choose a reason for hiding this comment

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

This is somewhat problematic, you should use the socket infra instead of popen.

In [1]: import socket

In [2]: ip = socket.gethostbyname(socket.gethostname())

In [3]: ip
Out[3]: '192.168.1.77'

Copy link
Author

Choose a reason for hiding this comment

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

I will use socket.gethostname() because socket.gethostbyname(socket.gethostname()) tends to give the loopback interface ip address this value is pulled from the /etc/hosts file by default on stuck configuration 127.0.0.1 is associated to the hostname

sys.exit(2)

# System Load
load_avg_1 = os.popen("cat /proc/loadavg|awk '{print $1,$2,$3}'").read()[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please look to use the subprocess.check_output method here? The os.popen commands have been deprecated.

https://docs.python.org/2/library/subprocess.html#subprocess.check_output
https://docs.python.org/2/library/subprocess.html#replacing-os-popen-os-popen2-os-popen3

Copy link
Author

Choose a reason for hiding this comment

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

unfortunately, check_output is not available on python2.6

client.write_points(load_15)

counter += 1
time.sleep(3)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a long sleep, mind making this 1s?

Copy link
Author

Choose a reason for hiding this comment

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

sure, no problem

@@ -40,8 +42,7 @@ def _convert_timestamp(timestamp, precision=None):
return ns / 1e9 / 60
elif precision == 'h':
return ns / 1e9 / 3600

raise ValueError(timestamp)
raise ValueError(timestamp)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be outdented, otherwise what happens if we don't hit any of the first two isinstance checks?

@eorochena
Copy link
Author

Implemented requested changes

@sebito91
Copy link
Contributor

Was thinking to add something like this for check_output support in the test, but to be fair this should be refactored to handle more cleanly.

@sebito91
Copy link
Contributor

The issue is in your py26_test.py, which makes sense since it's not using proper unittest.TestCase format like other tests. I'll submit a refactored test for you shortly, stay tuned.

@sebito91
Copy link
Contributor

OK, if you move remove your current py26_test.py and create a new test (you can call it the same thing) under ~/influxdb/tests/server_tests/<filename>.py, then replace your contents with the following from here you should be able to pass all of the tests.

We'll need to refactor some of the test code to bring these helpers out into the harness more easily, but for now this should get you working.

@eorochena
Copy link
Author

Implemented requested changes all travis ci checks passed

@sebito91
Copy link
Contributor

sebito91 commented Apr 8, 2020

We're not supporting <python2.7 at this point. Closing issue...

@sebito91 sebito91 closed this Apr 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants