Skip to content

Commit

Permalink
Tweak bashrc (#1363)
Browse files Browse the repository at this point in the history
* force color prompt

* add colorized bash prompt with git and conda info

* Increase timeout for ssh test

Co-authored-by: iameskild <[email protected]>
  • Loading branch information
dharhas and iameskild authored Jul 6, 2022
1 parent 9458555 commit 8355715
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
Expand Down Expand Up @@ -120,3 +120,33 @@ if ! shopt -oq posix; then
fi

. /opt/conda/etc/profile.d/conda.sh && conda activate base

# add nicer bash prompt
conda config --set changeps1 True

parse_git_branch() {
git branch --color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/'
}

BASE03=$(tput setaf 234)
BASE02=$(tput setaf 235)
BASE01=$(tput setaf 240)
BASE00=$(tput setaf 241)
BASE0=$(tput setaf 244)
BASE1=$(tput setaf 245)
BASE2=$(tput setaf 254)
BASE3=$(tput setaf 230)
YELLOW=$(tput setaf 136)
ORANGE=$(tput setaf 166)
RED=$(tput setaf 160)
MAGENTA=$(tput setaf 125)
VIOLET=$(tput setaf 61)
BLUE=$(tput setaf 33)
CYAN=$(tput setaf 37)
GREEN=$(tput setaf 64)
BOLD=$(tput bold)
RESET=$(tput sgr0)

NAME=`whoami | cut -d'@' -f1`

PS1="\[$CYAN\]$NAME:\w\[$RESET\]\$(parse_git_branch) \n\[$GREEN\]\A \$ \[$RESET\]"
10 changes: 6 additions & 4 deletions tests_deployment/test_jupyterhub_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

monkeypatch_ssl_context()

TIMEOUT_SECS = 300


@pytest.fixture
def paramiko_object():
Expand Down Expand Up @@ -57,12 +59,12 @@ def run_command(command, stdin, stdout, stderr):
return "".join(output).strip()


@pytest.mark.timeout(120)
@pytest.mark.timeout(TIMEOUT_SECS)
def test_simple_jupyterhub_ssh(paramiko_object):
stdin, stdout, stderr = paramiko_object.exec_command("")


@pytest.mark.timeout(120)
@pytest.mark.timeout(TIMEOUT_SECS)
def test_print_jupyterhub_ssh(paramiko_object):
stdin, stdout, stderr = paramiko_object.exec_command("")

Expand All @@ -81,7 +83,7 @@ def test_print_jupyterhub_ssh(paramiko_object):
print(run_command(command, stdin, stdout, stderr))


@pytest.mark.timeout(120)
@pytest.mark.timeout(TIMEOUT_SECS)
def test_exact_jupyterhub_ssh(paramiko_object):
stdin, stdout, stderr = paramiko_object.exec_command("")

Expand All @@ -100,7 +102,7 @@ def test_exact_jupyterhub_ssh(paramiko_object):
assert output == run_command(command, stdin, stdout, stderr)


@pytest.mark.timeout(120)
@pytest.mark.timeout(TIMEOUT_SECS)
def test_contains_jupyterhub_ssh(paramiko_object):
stdin, stdout, stderr = paramiko_object.exec_command("")

Expand Down

0 comments on commit 8355715

Please sign in to comment.