From f7bd8afc0ad6b288ffcd7dc9f50d2eb56c952ed3 Mon Sep 17 00:00:00 2001 From: kngwyu Date: Thu, 18 Jun 2020 18:10:54 +0900 Subject: [PATCH] Add a test for --features nighly on travis --- .travis.yml | 10 ++++++---- ci/travis/setup.sh | 2 +- ci/travis/test.sh | 2 +- src/lib.rs | 2 +- tests/test_compile_error.rs | 10 +++------- tests/test_datetime.rs | 1 - 6 files changed, 12 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8f9d450ddcf..b1f946d8bbe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,23 +16,25 @@ jobs: python: "3.7" - name: Python 3.8 python: "3.8" + # Run clippy and rustfmt + env: RUN_LINT=1 - name: Python 3.9-dev python: "3.9-dev" - - name: Minimum nightly + - name: Nightly python: "3.7" - # Keep this synced up with build.rs and ensure that the nightly version does have clippy available - # https://static.rust-lang.org/dist/YYYY-MM-DD/clippy-nightly-x86_64-unknown-linux-gnu.tar.gz exists - env: TRAVIS_RUST_VERSION=nightly-2020-01-21 + env: TRAVIS_RUST_VERSION=nightly FEATURES="nightly" - name: PyPy3.5 7.0 # Tested via anaconda PyPy (since travis's PyPy version is too old) python: "3.7" env: FEATURES="pypy" PATH="$PATH:/opt/anaconda/envs/pypy3/bin" allow_failures: + - name: Nightly - python: 3.9-dev env: global: - TRAVIS_RUST_VERSION=stable - RUST_BACKTRACE=1 + - RUN_LINT=0 before_install: - source ./ci/travis/setup.sh diff --git a/ci/travis/setup.sh b/ci/travis/setup.sh index d9c6f66e35f..c436691afc4 100755 --- a/ci/travis/setup.sh +++ b/ci/travis/setup.sh @@ -7,7 +7,7 @@ set -e # Use profile=minimal here to skip installing clippy curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=$TRAVIS_RUST_VERSION --profile=minimal -y export PATH=$PATH:$HOME/.cargo/bin -if [ "$TRAVIS_JOB_NAME" = "Minimum nightly" ]; then +if [[ $RUN_LINT == 1 ]]; then rustup component add clippy rustup component add rustfmt fi diff --git a/ci/travis/test.sh b/ci/travis/test.sh index 975e05bc42a..eb85e926aca 100755 --- a/ci/travis/test.sh +++ b/ci/travis/test.sh @@ -10,7 +10,7 @@ else PYTHON_SYS_EXECUTABLE="/opt/anaconda/envs/pypy3/bin/pypy3" cargo build; fi -if [ "$TRAVIS_JOB_NAME" = "Minimum nightly" ]; then +if [[ $RUN_LINT == 1 ]]; then pip install --pre black==19.3b0 make lint fi diff --git a/src/lib.rs b/src/lib.rs index 948af9d6b55..f55b1a07102 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(nightly, feature(specialization))] +#![cfg_attr(feature = "nightly", feature(specialization))] #![allow(clippy::missing_safety_doc)] // FIXME (#698) //! Rust bindings to the Python interpreter. diff --git a/tests/test_compile_error.rs b/tests/test_compile_error.rs index 6820d3ee139..67ab76980b4 100644 --- a/tests/test_compile_error.rs +++ b/tests/test_compile_error.rs @@ -7,11 +7,7 @@ fn test_compile_errors() { t.compile_fail("tests/ui/missing_clone.rs"); t.compile_fail("tests/ui/reject_generics.rs"); t.compile_fail("tests/ui/wrong_aspyref_lifetimes.rs"); - // Since the current minimum nightly(2020-01-20) has a different error message, - // we skip this test. - // TODO(kngwyu): Remove this `if` when we update minimum nightly. - if option_env!("TRAVIS_JOB_NAME") != Some("Minimum nightly") { - t.compile_fail("tests/ui/invalid_pymethod_names.rs"); - t.compile_fail("tests/ui/static_ref.rs"); - } + t.compile_fail("tests/ui/static_ref.rs"); + #[cfg(not(feature = "nightly"))] + t.compile_fail("tests/ui/invalid_pymethod_names.rs"); } diff --git a/tests/test_datetime.rs b/tests/test_datetime.rs index 15928f77b66..ba043dfae64 100644 --- a/tests/test_datetime.rs +++ b/tests/test_datetime.rs @@ -1,4 +1,3 @@ -use pyo3::ffi::*; use pyo3::prelude::*; use pyo3::types::IntoPyDict;