Skip to content
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

SQL generation scripts for snapshot tests DB #105

Merged
merged 20 commits into from Jul 17, 2018
Merged

Conversation

amartyashankha
Copy link
Collaborator

@amartyashankha amartyashankha commented Jul 10, 2018

No description provided.

@obi1kenobi
Copy link
Contributor

If you can appease Travis, this is fine by me.

amartyashankha and others added 4 commits July 12, 2018 11:48
* Adding scripts to create db.

* Generated Commands file.

* Added OrientDB schema file

* Fixed flake8 error.

* Ensure unique parent sets

* Addressing comments

* Addressing comments

* Addressing comments

* Addressing comments

* Using six.iteritems

* Added conftest DB generation

* Added snapshot tests

* Added conftest file

* Generated snapshots file

* Adding empty parameters to test inputs

* Fixed commands import

* Adding parametrized test case

*  Modifying filter on optional test case

* Adding newlines to commands, and checking for comments

* Adding outputs to filter_on_optional_variable

* Deterministic order of keys

* Deterministic order of keys

* Adding noqa to snapshots

* Adding pyorient to dev requirements

* Adding snapshottest to dev requirements

* Fixing pylint error

* Fixing dev requirements

* Adding orientdb install script

* Updating snapshots file

* Adding compiler version instead of git version.

* Turning list of OrientDB results into set of frozensets.

* Turning list of OrientDB results into frozenset of Counter of frozensets.

* Using docker-compose to set up orientdb.

* Using docker-compose to set up orientdb.

* Detach docker-compose in travis

* Fixing lint errors

* Updating travis.yml to ignore snapshot files for flake8.

* Converting lists to tuples in query results

* Addressing comments

* Fixing docker-compose

* Fixing isort

* Fixing more lint errors

* Capitalizing OrientDB

* Fixing more lint errors

* Moved sample parameters to snapshot testing file

* Addressing comments

* Trying pylint fix

* pylint fix

* Fixed typo.
@coveralls
Copy link

coveralls commented Jul 16, 2018

Coverage Status

Coverage decreased (-0.03%) to 94.793% when pulling e47ed53 on feat_snapshot_tests into cc373ce on master.

.coveragerc Outdated
@@ -1,6 +1,14 @@
[run]
# We don't want to include the tests themselves in the coverage report
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is outdated now, since more than one thing is omitted.

.travis.yml Outdated
@@ -4,16 +4,26 @@ cache: pip
python:
- "2.7"
- "3.6"
services:
- docker
Copy link
Contributor

Choose a reason for hiding this comment

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

bad indentation

@@ -0,0 +1 @@
# Copyright 2017-present Kensho Technologies, LLC.
Copy link
Contributor

Choose a reason for hiding this comment

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

scripts is not a package and shouldn't have an __init__ file

import random
import sys

from ... import __version__
Copy link
Contributor

Choose a reason for hiding this comment

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

Since scripts isn't supposed to be a package, you might have to read the version "manually" -- read the file then regex out the __version__ variable's value. The setup.py already does this, follow its lead.

return base_name + SEPARATOR + label


def strip_index_from_name(name):
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe try to find a better name for this function? The name doesn't seem to match the return value.

@@ -0,0 +1,37 @@
# Copyright 2017-present Kensho Technologies, LLC.
Copy link
Contributor

Choose a reason for hiding this comment

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

All the files that are brand new are Copyright 2018-present, not 2017-present. This is very important!

@@ -0,0 +1,39 @@
# Copyright 2018-present Kensho Technologies, LLC.

Copy link
Contributor

Choose a reason for hiding this comment

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

consistency: the other files have the first import immediately below the copyright line, but this one has a blank line in between

set_up_successfully = True
break
except Exception: # pylint: disable=broad-except
time.sleep(1)
Copy link
Contributor

Choose a reason for hiding this comment

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

log the exception

@obi1kenobi
Copy link
Contributor

obi1kenobi commented Jul 17, 2018

Also, there's a warning in the test logs that you should address:

$ docker-compose up -d
WARNING: Some services (orientdb) use the 'deploy' key, which will be ignored. Compose does not support 'deploy' configuration - use `docker stack deploy` to deploy to a swarm.

I think you just need to remove the deploy key entirely.

# intentionally *not* adding an encoding option to open
# see here:
# https://github.com/pypa/virtualenv/issues/201#issuecomment-3145690
top_level_directory = os.path.dirname(os.getcwd())
Copy link
Contributor

Choose a reason for hiding this comment

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

cwd isn't constant, so this code is brittle -- use __file__ because this file's location is fixed, then make it relative to that



def read_file(filename):
"""Read package file as text to get its version"""
Copy link
Contributor

Choose a reason for hiding this comment

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

there's no version checking going on in this function

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Didn't quite get this comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

read_file has a docstring that says it gets a version -- no such thing happens in this function, and what the caller uses this function for is the caller's business. I think the docstring should be updated.

@@ -1,12 +1,12 @@
# Copyright 2018-present Kensho Technologies, LLC.
from glob import glob
from os import path
from os import path, getcwd
Copy link
Contributor

Choose a reason for hiding this comment

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

you don't seem to be using getcwd

.coveragerc Outdated
graphql_compiler/tests/*

# No coverage for SQL command generation script
graphql_compiler/scripts/generate_test_sql/*
Copy link
Contributor

Choose a reason for hiding this comment

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

This path doesn't exist anymore.

obi1kenobi
obi1kenobi previously approved these changes Jul 17, 2018
@obi1kenobi
Copy link
Contributor

I think #105 (comment) is the last thing that needs to be addressed before we merge.

@obi1kenobi obi1kenobi merged commit 71d485c into master Jul 17, 2018
@obi1kenobi obi1kenobi deleted the feat_snapshot_tests branch July 17, 2018 19:59
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.

None yet

3 participants