小编Roh*_*ary的帖子

错误:pathspec'test-branch'与git已知的任何文件都不匹配

我是Git的新用户.我已经分叉了一个名为Spoon-Knife的存储库(可以用Git练习分叉).然后,我通过运行在本地克隆它

git clone https://github.com/rohinichoudhary/Spoon-Knife.git
Run Code Online (Sandbox Code Playgroud)

该存储库包含三个分支,即

  • master,
  • test-branch,
  • change-the-title.

当我跑git branch,它只显示*master,而不是剩下的两个分支.当我跑

git checkout test-branch
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

错误:pathspec'test-branch'与git已知的任何文件都不匹配.

为什么会这样?我怎么解决这个问题?

git github git-checkout git-fork

40
推荐指数
5
解决办法
12万
查看次数

元素不可见错误(无法单击元素)

我想点击一个单选按钮,出现在网页上.代码如下:

HTML代码:

<div class="small-checkbox red-theme raleway-regular text-muted2 position-relative">

        <div class="city-checkbox inline-block position-relative" ng-class="{'rounded-checkbox': main.current_city_id == 1, 'mb-20': main.ifDeviceIsPhone}">
            <label class="mdl-radio mdl-js-radio mdl-js-ripple-effect mh-20" for="mumbaiCity" ng-class="{'is-checked' : main.current_city_id == 1}">
                <input type="radio" id="mumbaiCity" class="mdl-radio__button position-relative vertical-middle" name="city" value="1" ng-click="main.setCity('Mumbai', 1)">
                <span class="mdl-radio__label position-relative font15"><img class="city-icon" src="../../../assets/img/cities/mumbai-icon.png">Mumbai</span>
            </label>
        </div>
</div>
Run Code Online (Sandbox Code Playgroud)

Tesstcase:

// demo-test.js
describe('Protractor Demo App', function() {
    jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000000;

    it('check item count', function() {
        browser.get('<link>');
        element(by.id('mumbaiCity')).click();
    });

});
Run Code Online (Sandbox Code Playgroud)

此测试通过错误:

1)量角器演示App检查项目计数

信息:

失败:元素不可见

我也尝试过:

element(by.css('[ng-click="main.setCity('Mumbai', 1)"]')).click();
Run Code Online (Sandbox Code Playgroud)

它给出了错误:

[16:16:26] E/launcher - 错误:SyntaxError:missing)参数列表后面 …

javascript selenium angularjs selenium-webdriver protractor

38
推荐指数
1
解决办法
4万
查看次数

使用Mock Python返回Iterable

我正在尝试使用Mock来模拟python中的一个函数.这是我的代码:

    resp, content = request(...)
Run Code Online (Sandbox Code Playgroud)

request()函数需要返回两个值.这是我试过的:

    with patch("syncdatetime.py") as sync_mock:
        sync_mock.request.return_value = [obj, '']
Run Code Online (Sandbox Code Playgroud)

但是当我运行测试时,我得到错误"模拟对象不可迭代".请求函数返回Mock类型的对象而不是列表.如何修改请求函数以便返回列表?

python mocking

18
推荐指数
2
解决办法
2万
查看次数

使用带有django形式的ajax时,得到错误"选择一个有效的选择.这不是可用的选择之一."

我是django的新手.我正在使用简单的ajax 在课程选择的基础上动态更新选择字段学期.但在提交表单时我收到错误选择一个有效的选择.选择的选项不是可用选项之一.代码如下:

forms.py:

from django import forms
from feedback_form.models import course,section_info

class loginForm(forms.Form):
     iquery1 = course.objects.values_list('course_name', flat = True)
     iquery1_choices = [('', '----------')] + [(id, id) for id in iquery1]
     sem_choices = [('', '----------')]

     course_name = forms.ChoiceField(iquery1_choices,required=True, widget=forms.Select())
     semester = forms.ChoiceField(sem_choices, required= True, widget=forms.Select())
Run Code Online (Sandbox Code Playgroud)

views.py:

def get_batch(request, c_id):
    current_course = feedback_form.models.course.objects.get(course_name=c_id)
    batches = feedback_form.models.batch.objects.all().filter(course_id=current_course)
    no_of_sem = feedback_form.models.course.objects.values_list('number_of_sem', flat=True).filter(course_id = current_course)
    no_of_sem = int(no_of_sem[0])
    batch_dict = {}
    for batch in batches:
         batch_dict[batch.batch_id] = …
Run Code Online (Sandbox Code Playgroud)

django ajax jquery django-forms

10
推荐指数
1
解决办法
2191
查看次数

无法使用phantomjs进行量角器测试

我正在使用量角器来测试Angular代码.当我通过chromedriver驱动程序运行它时,测试运行正常,默认情况下使用webdriver-manager.现在我想用phantomjs(无头浏览器)运行相同的测试,因为我需要通过服务器运行此测试.但是当通过phantomjs运行测试时,我收到错误:

失败:在页面URL上找不到Angular:重试超出角度的重试次数

Conf文件是:

exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['demo-test.js'],
capabilities: {
  browserName: 'phantomjs',
  version: '',
  platform: 'ANY'
};
Run Code Online (Sandbox Code Playgroud)

demo-test.js文件看起来像:

// demo-test.js
describe('Protractor Demo App', function() {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000000;

beforeEach(function() {
    browser.driver.manage().window().setSize(1280, 1024);
});
it('should have a title', function() {
  browser.get('URL');

  expect(browser.getTitle()).toEqual('Title');

});
Run Code Online (Sandbox Code Playgroud)

请帮帮我.我已经使用官方网站的说明安装了量角器,并通过安装了phantomjs

sudo apt-get install phantomjs

phantomjs angularjs protractor

5
推荐指数
1
解决办法
650
查看次数

无法连接到远程托管的RabbitMQ服务器

我已经使用引用在Ubuntu 16.04服务器上安装和配置了RabbitMQ .由于默认用户默认guest只允许在本地连接,因此我添加了一个具有管理员标记的新用户并设置了其权限,以便它可以访问/虚拟主机.我启用了RabbitMQ管理控制台.我已成功登录我创建的用户.当我通过localhost使用我创建的用户连接到RabbitMQ时,我也能够连接它.但是当我尝试使用以下代码通过其他服务器连接RabbitMQ服务器时:

import pika
credentials = pika.PlainCredentials('new_user', 'new_pass')
parameters = pika.ConnectionParameters('<server's Public IP>', 5672,'/',credentials)
connection = pika.BlockingConnection(parameters)
Run Code Online (Sandbox Code Playgroud)

它抛出一个错误:

回溯(最近一次调用最后一次):文件"",第1行,在文件"/Library/Python/2.7/site-packages/pika/adapters/blocking_connection.py",第339行,在init self._process_io_for_connection_setup()文件中/Library/Python/2.7/site-packages/pika/adapters/blocking_connection.py",第374行,在_process_io_for_connection_setup self._open_error_result.is_ready中)文件"/Library/Python/2.7/site-packages/pika/adapters/blocking_connection. py",第395行,在_flush_output中引发exceptions.ConnectionClosed()pika.exceptions.ConnectionClosed

相同的代码工作正常,当我在服务器上运行的代码,其上的RabbitMQ安装和替换<server's Public IP>0.0.0.0.

输出 sudo netstat -nltp

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:25672           0.0.0.0:*               LISTEN      18021/beam
tcp        0      0 0.0.0.0:4369            0.0.0.0:*               LISTEN      18110/epmd
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1230/sshd
tcp …
Run Code Online (Sandbox Code Playgroud)

rabbitmq server

5
推荐指数
1
解决办法
261
查看次数