From aadb97240892a59e79927f69a6a2422c219a091c Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Fri, 9 Nov 2018 09:26:49 -0800 Subject: [PATCH 1/2] TST: remove references to Travis. Fix conda tests. Removes the last references to Travis from the README and configuration files. I've attempted to fix the conda build by updating the null floats test to have at neast 1 non-null value. --- .travis.yml | 64 ---------------------------- README.rst | 4 +- ci/travis_encrypt_gbq.sh | 34 --------------- ci/travis_gbq.json.enc | Bin 2352 -> 0 bytes ci/travis_gbq_config.txt | 2 - ci/travis_process_gbq_encryption.sh | 13 ------ tests/system/conftest.py | 6 +-- tests/system/test_gbq.py | 6 ++- 8 files changed, 7 insertions(+), 122 deletions(-) delete mode 100644 .travis.yml delete mode 100755 ci/travis_encrypt_gbq.sh delete mode 100644 ci/travis_gbq.json.enc delete mode 100644 ci/travis_gbq_config.txt delete mode 100644 ci/travis_process_gbq_encryption.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a92996cd..00000000 --- a/.travis.yml +++ /dev/null @@ -1,64 +0,0 @@ -language: python - -matrix: - include: - - os: linux - python: 2.7 - env: PYTHON=2.7 PANDAS=0.19.2 COVERAGE='false' LINT='false' - - os: linux - python: 3.5 - env: PYTHON=3.5 PANDAS=0.18.1 COVERAGE='true' LINT='false' - # https://github.com/pydata/pandas-gbq/issues/189 - # - os: linux - # python: 3.6 - # env: PYTHON=3.6 PANDAS=0.20.1 COVERAGE='false' LINT='false' - - os: linux - python: 3.6 - env: PYTHON=3.6 PANDAS=MASTER COVERAGE='false' LINT='true' -env: - -before_install: - - echo "before_install" - - source ci/travis_process_gbq_encryption.sh - -install: - # Upgrade setuptools and pip to work around - # https://github.com/pypa/setuptools/issues/885 - - pip install --upgrade setuptools - - pip install --upgrade pip - - REQ="ci/requirements-${PYTHON}-${PANDAS}" ; - if [ -f "$REQ.pip" ]; then - pip install --upgrade nox ; - else - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; - bash miniconda.sh -b -p $HOME/miniconda ; - export PATH="$HOME/miniconda/bin:$PATH" ; - hash -r ; - conda config --set always_yes yes --set changeps1 no ; - conda config --add channels pandas ; - conda config --add channels conda-forge ; - conda update -q conda ; - conda info -a ; - conda create -q -n test-environment python=$PYTHON ; - source activate test-environment ; - conda install -q setuptools ; - conda install -q pandas=$PANDAS; - conda install -q --file "$REQ.conda"; - conda list ; - python setup.py install ; - fi - -script: - - if [[ $PYTHON == '2.7' ]]; then - pip install -r ci/requirements-2.7-0.19.2.pip ; - pip install -e . ; - pytest tests/unit ; - fi - - if [[ $PYTHON == '3.5' ]]; then nox -s test_earliest_deps ; fi - - if [[ $PYTHON == '3.6' ]] && [[ "$PANDAS" == "MASTER" ]]; then nox -s test_latest_deps ; fi - - REQ="ci/requirements-${PYTHON}-${PANDAS}" ; - if [ -f "$REQ.conda" ]; then - pytest --quiet -m 'not local_auth' -v tests ; - fi - - if [[ $COVERAGE == 'true' ]]; then nox -s cover ; fi - - if [[ $LINT == 'true' ]]; then nox -s lint ; fi diff --git a/README.rst b/README.rst index 87a1cbdc..93c87f39 100644 --- a/README.rst +++ b/README.rst @@ -37,8 +37,8 @@ Usage See the `pandas-gbq documentation `_ for more details. -.. |Build Status| image:: https://travis-ci.org/pydata/pandas-gbq.svg?branch=master - :target: https://travis-ci.org/pydata/pandas-gbq +.. |Build Status| image:: https://circleci.com/gh/pydata/pandas-gbq/tree/master.svg?style=svg + :target: https://circleci.com/gh/pydata/pandas-gbq/tree/master .. |Version Status| image:: https://img.shields.io/pypi/v/pandas-gbq.svg :target: https://pypi.python.org/pypi/pandas-gbq/ .. |Coverage Status| image:: https://img.shields.io/codecov/c/github/pydata/pandas-gbq.svg diff --git a/ci/travis_encrypt_gbq.sh b/ci/travis_encrypt_gbq.sh deleted file mode 100755 index e404ca73..00000000 --- a/ci/travis_encrypt_gbq.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -GBQ_JSON_FILE=$1 - -if [[ $# -ne 1 ]]; then - echo -e "Too few arguments.\nUsage: ./travis_encrypt_gbq.sh "\ - "" - exit 1 -fi - -if [[ $GBQ_JSON_FILE != *.json ]]; then - echo "ERROR: Expected *.json file" - exit 1 -fi - -if [[ ! -f $GBQ_JSON_FILE ]]; then - echo "ERROR: File $GBQ_JSON_FILE does not exist" - exit 1 -fi - -echo "Encrypting $GBQ_JSON_FILE..." -read -d "\n" TRAVIS_KEY TRAVIS_IV <<<$(travis encrypt-file $GBQ_JSON_FILE \ -travis_gbq.json.enc -f | grep -o "\w*_iv\|\w*_key"); - -echo "Adding your secure key to travis_gbq_config.txt ..." -echo -e "TRAVIS_IV_ENV=$TRAVIS_IV\nTRAVIS_KEY_ENV=$TRAVIS_KEY"\ -> travis_gbq_config.txt - -echo "Done. Removing file $GBQ_JSON_FILE" -rm $GBQ_JSON_FILE - -echo -e "Created encrypted credentials file travis_gbq.json.enc.\n"\ - "NOTE: Do NOT commit the *.json file containing your unencrypted" \ - "private key" diff --git a/ci/travis_gbq.json.enc b/ci/travis_gbq.json.enc deleted file mode 100644 index 6c6735b1a1489832c81393d3c6fb70db9335d2d4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2352 zcmV-03D5TNnqlXdY++)PWyH+_Fy*(K>9equQPR*sFH~Mv7?ngs_L)!gA#S%}I{l{Q zTNi$V9;3O4Z!v+`HNswsC?HD8;K91|kaWxdyIM^>oTz_m-uc5_#E)oKjY~K%0W+_ z{RHA}EvU@I6smY4s&Pv}R!FPGKJm6C)+Xod+@fD<>l7E_I%_#04fxtS<-e6nYZ!A} z_r18*Ck1zY4=na-VJhD!Oov>xZ4w zMPj0)WRya$gv)>0djJ$Y_mhE8yS)5V^`CYksDz)UGTg(^Zo9jeX|+f0RW8w_kDLgL zql4Mht+n8+((UU-@>iV}PLuE}ipFNb$?@5HDvMQQ0@|OAK-2ih|8Ys_@)u@GKc5X~ z3MxX!cC6)~gzV}Rgu@+^I@Kn6huy?c{7c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W@ z^OC_L$GnbnZICluyyKVSfYbLnJ?gQ;o|^SO;TvKq_-)wNnl~jBNKpDorUby$qP+`v z5uMZ{RWGTSuxo5kYHPmAGV34^FF!%@SL^7Q_)ADuLH1U@>EYWjY9a&nq28F5=sza{ z3O?fO^%Q>o<$+EzkI5+6U>bI=RVYekMwJ{j<+-=jnp6+Gx9 zV)Gp@%eX)78ggwV@9%XL&KK;dacY9^-p~5sHM&GQnD=%R?iMt)CmWf>Y$Dy1=Zfvl WtYFY3cqn_L%Flv2;xfP?pVh*qxS|69 diff --git a/ci/travis_gbq_config.txt b/ci/travis_gbq_config.txt deleted file mode 100644 index fe22dbed..00000000 --- a/ci/travis_gbq_config.txt +++ /dev/null @@ -1,2 +0,0 @@ -TRAVIS_IV_ENV=encrypted_53f0a3897064_iv -TRAVIS_KEY_ENV=encrypted_53f0a3897064_key diff --git a/ci/travis_process_gbq_encryption.sh b/ci/travis_process_gbq_encryption.sh deleted file mode 100644 index 9967d40e..00000000 --- a/ci/travis_process_gbq_encryption.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -source ci/travis_gbq_config.txt - -if [[ -n ${SERVICE_ACCOUNT_KEY} ]]; then - echo "${SERVICE_ACCOUNT_KEY}" > ci/travis_gbq.json; -elif [[ -n ${!TRAVIS_IV_ENV} ]]; then - openssl aes-256-cbc -K ${!TRAVIS_KEY_ENV} -iv ${!TRAVIS_IV_ENV} \ - -in ci/travis_gbq.json.enc -out ci/travis_gbq.json -d; - export GBQ_PROJECT_ID='pandas-travis'; - echo 'Successfully decrypted gbq credentials' -fi - diff --git a/tests/system/conftest.py b/tests/system/conftest.py index cd5a89be..5091d717 100644 --- a/tests/system/conftest.py +++ b/tests/system/conftest.py @@ -16,11 +16,7 @@ def project_id(): @pytest.fixture(scope="session") def private_key_path(): path = None - if "TRAVIS_BUILD_DIR" in os.environ: - path = os.path.join( - os.environ["TRAVIS_BUILD_DIR"], "ci", "travis_gbq.json" - ) - elif "GBQ_GOOGLE_APPLICATION_CREDENTIALS" in os.environ: + if "GBQ_GOOGLE_APPLICATION_CREDENTIALS" in os.environ: path = os.environ["GBQ_GOOGLE_APPLICATION_CREDENTIALS"] elif "GOOGLE_APPLICATION_CREDENTIALS" in os.environ: path = os.environ["GOOGLE_APPLICATION_CREDENTIALS"] diff --git a/tests/system/test_gbq.py b/tests/system/test_gbq.py index 9ae1fbf2..b47d818e 100644 --- a/tests/system/test_gbq.py +++ b/tests/system/test_gbq.py @@ -297,12 +297,14 @@ def test_should_properly_handle_nullable_doubles(self, project_id): ) def test_should_properly_handle_null_floats(self, project_id): - query = "SELECT FLOAT(NULL) AS null_float" + query = """SELECT null_float + FROM UNNEST(ARRAY[NULL, 1.0]) AS null_float' + """ df = gbq.read_gbq( query, project_id=project_id, credentials=self.credentials, - dialect="legacy", + dialect="standard", ) tm.assert_frame_equal(df, DataFrame({"null_float": [np.nan]})) From def2eecba64bea1c0171bb2a8eab066bbf50fa7b Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Fri, 9 Nov 2018 09:44:55 -0800 Subject: [PATCH 2/2] fix null float test. --- tests/system/test_gbq.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system/test_gbq.py b/tests/system/test_gbq.py index b47d818e..dde34cb1 100644 --- a/tests/system/test_gbq.py +++ b/tests/system/test_gbq.py @@ -298,7 +298,7 @@ def test_should_properly_handle_nullable_doubles(self, project_id): def test_should_properly_handle_null_floats(self, project_id): query = """SELECT null_float - FROM UNNEST(ARRAY[NULL, 1.0]) AS null_float' + FROM UNNEST(ARRAY[NULL, 1.0]) AS null_float """ df = gbq.read_gbq( query, @@ -306,7 +306,7 @@ def test_should_properly_handle_null_floats(self, project_id): credentials=self.credentials, dialect="standard", ) - tm.assert_frame_equal(df, DataFrame({"null_float": [np.nan]})) + tm.assert_frame_equal(df, DataFrame({"null_float": [np.nan, 1.0]})) def test_should_properly_handle_timestamp_unix_epoch(self, project_id): query = 'SELECT TIMESTAMP("1970-01-01 00:00:00") AS unix_epoch'