-
Notifications
You must be signed in to change notification settings - Fork 26
MAINT Configure Windows CI using AppVeyor #258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MAINT Configure Windows CI using AppVeyor #258
Conversation
by checking just whether or not poller is called. Asserting a specific call count for a given sleep time is not practical, because of different execution/testing environments (Circle CI versus AppVeyor, for example).
Because polling_interval is 0.01, setting sleep time of 0.02s should (hopefully) be long enough to register at least 1 poller call.
feather-format depends on pyarrow, which does not have Windows packages for python version < 3.5. See https://arrow.apache.org/docs/python/install.html
civis/tests/test_io.py
Outdated
polling_interval=POLL_INTERVAL) | ||
result = result.result() | ||
cls.export_url = result['output'][0]['path'] | ||
assert result.state == 'succeeded' | ||
|
||
cls.export_job_id = result.sql_id | ||
|
||
@pytest.mark.skipif(sys.platform.startswith('win')) # TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you fix this test? Does it still need to be skipped in Windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test isn't fixed yet, and I plan to. I threw in this skipif thing to suppress for something else. We're very close to getting the whole thing working. I'll tag you when the PR is ready fo review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Great work on this so far!
The archive name is a member file inside a zip file. It'd seem more reasonable to have it different than the zip file name.
civis/tests/test_io.py
Outdated
fname = os.path.join(temp_dir, str(uuid.uuid4())) | ||
with zipfile.ZipFile(fname, 'w', zipfile.ZIP_DEFLATED) as zip_file: | ||
archive_name = str(uuid.uuid4()) | ||
zip_file.writestr(archive_name, 'a,b,c\n1,2,3') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
archive_name
should be its own distinct filename rather than being the same as the zipf file's filename. Also, using the zip file's filename failed this test because apparently the ZipFile
object normalizes backslashes into forward slashes in filenames internally, which caused test failures like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this means that you can't use archive_name = os.path.join(temp_dir, str(uuid.uiid4()))
? If you run the tests locally, won't this litter your folder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just run the test suite locally to verify that no random temp files are created. zip_file.writestr(archive_name, ...)
writes a new member file named archive_name
to zip_file
which is the already instantiated temp zip file; it doesn't mean creating a file called archive_name
at the current directory.
time.sleep(0.015) | ||
assert poller.call_count == 1 | ||
time.sleep(0.02) | ||
assert poller.call_count > 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because now we have different execution environments for builds (Circle CI versus AppVeyor), this test has become a little unstable (see this test failure due to such indeterminancy). Given polling_internal=0.01
(set just a few lines above, via PollableResult
), sleeping 0.02s gives a little more time for at least one poller call count.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was a little unstable in the Linux tests, to be honest. Hopefully this change makes life better for everyone. Thank you!
@@ -7,7 +7,7 @@ vcrpy>=1.11.0,<=1.11.99 | |||
vcrpy-unittest==0.1.6 | |||
sphinx_rtd_theme>=0.2.4,<1.0.0 | |||
numpydoc>=0.7.0,<1.0.0 | |||
feather-format | |||
feather-format; sys_platform != 'win32' or python_version >= '3.5' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feather-format
depends on pyarrow
, which doesn't have a Windows installer for Python < 3.5; see here. Not having feather-format
installed skips one test only, which I think is fine (and we are running this test for Python >= 3.5 on Windows anyway).
@keithing I've defeated AppVeyor! Good news is that only changes in tests are needed for Windows compatibility. It's mostly about not using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! @stephen-hoover, you on board for adding Windows tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! I left a couple of comments in places where I think the code could be made a bit cleaner by fully embracing the temporary directory, but I'm happy merging this as is.
civis/ml/tests/test_model.py
Outdated
with tempfile.NamedTemporaryFile() as tempfname: | ||
fname = tempfname.name | ||
with TemporaryDirectory() as temp_dir: | ||
fname = os.path.join(temp_dir, str(uuid.uuid4())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need a uuid for anything created in a temporary directory -- the file will vanish as soon as you exit the context, and I don't see a danger of a name collision inside this test.
civis/tests/test_io.py
Outdated
with open(fname, 'w+b') as tmp: | ||
tmp.write(b'a,b,c\n1,2,3') | ||
tmp.flush() | ||
tmp.seek(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would exit the write context and re-open the file in a new with open(...)
context here. The seek(0)
was so that we could use a temporary file which disappeared when closed.
civis/tests/test_io.py
Outdated
fname = os.path.join(temp_dir, str(uuid.uuid4())) | ||
with open(fname, 'w+b') as tmp: | ||
tmp.write(b'a,b,c\n1,2,3') | ||
tmp.flush() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be unnecessary now that we're using a write context manager, but it also won't hurt anything.
time.sleep(0.015) | ||
assert poller.call_count == 1 | ||
time.sleep(0.02) | ||
assert poller.call_count > 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was a little unstable in the Linux tests, to be honest. Hopefully this change makes life better for everyone. Thank you!
Hmm, I've made changes according to Stephen's suggestions, but now the builds fail for Python 3.5 and 3.6 (for both Linux and Windows builds). For these two Python versions, it looks like we're using whatever the latest version of Indeed, all builds passed with Back to the most recent build failures for Python 3.5 and 3.6, it looks like when I'll come back to this PR later in the day. |
This test failure was caused by pandas-dev/pandas#21300 . I'm not sure if it represents a bug on our end or just a change in the parameter options available for |
#259 fixes |
I'm sorting out the repo / AppVeyor settings with IT support. Sit tight, everyone. |
We're all set. All builds for both Linux and Windows have passed. This PR is ready for review again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great. Thanks for sticking with this. LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you for doing this!
IT support has turned on AppVeyor for CI in Windows. This PR configures that, based on what we already have for Circle CI.
Resolves #10.