小编mog*_*oli的帖子

没有测试来执行msTest

我正在尝试使用MSTest在命令行上运行.NET单元测试

我的命令是

"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe" /testcontainer:"full path of dll" /resultsfile:TestResults.trx
Run Code Online (Sandbox Code Playgroud)

运行时返回

开始执行......
没有要执行的测试.

单元测试在VS 2012 IDE中运行得非常好.

我需要做些什么才能让它在cmd线上运行?

.net c# command-line mstest visual-studio

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

詹金斯挂着git fetch

我是Jenkins的新手,我试图让它在我的.NET项目中运行一些单元测试.

当我运行构建时,它会在尝试从git存储库中获取时挂起.

错误:10分钟后超时

C:\ Program Files\Git\cmd\git.exe config --local --remove-section credential #timetime = 10错误:获取远程repo'origin'时出错hudson.plugins.git.GitException:无法从https获取: //github.com/name.of.repo

我已生成已知主机并将.ssh目录复制到C:\ Windows\SysWOW64\config\systemprofile.ssh,按照jenkins说明https://wiki.jenkins-ci.org/display/JENKINS/Git+插件下"詹金斯,GIT插件和Windows"

我从cmd行运行了ssh git@github.com,我可以成功进行身份验证.

有什么想法吗?

谢谢 :)

git ssh github jenkins jenkins-plugins

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

迭代 MultiDict 中的键和所有值

我有一本字典

params = ImmutableMultiDict([('dataStore', 'tardis'), ('symbol', '1'), ('symbol', '2')])
Run Code Online (Sandbox Code Playgroud)

我希望能够迭代字典并获取所有值及其键的列表。但是,当我尝试这样做时,它只获取第一个符号键值对并忽略另一个。

for k in params:
    print(params.get(k))
Run Code Online (Sandbox Code Playgroud)

python flask

8
推荐指数
2
解决办法
4797
查看次数

在 React 应用程序中测试 Select 元素

我想编写一个测试来检查我何时更改 React 应用程序中选择元素的值。

import React, { Component } from 'react';

const TimeList =(props) =>{



return(
    <div>
    <label>
      Time
      <br/>
      <select name="lessonTime" value={props.defaultTime} onChange={props.handleChange}>
        <option value="8:00">8:00</option>
        <option value="8:30">8:30</option>
        <option value="9:00">9:00</option>
        <option value="10:00">10:00</option>
        <option value="12:00">12:00</option>
        <option value="13:30">13:30</option>
        <option value="19:00">19:00</option>
        <option value="19:30">19:30</option>
      </select>
    </label>
    </div>
  );

};

export default TimeList;
Run Code Online (Sandbox Code Playgroud)

我的测试代码:

it('should select correct time',() =>{
    const mockFunc = jest.fn();
    const wrapper = mount(<TimeList value='10:00'
    onChange={mockFunc}/>)
    console.log(wrapper.props());
    wrapper.find('select').simulate('change',{target:{value:'8:00'}});
    expect(wrapper.find('select').props().value).toBe('8:00');
  });
Run Code Online (Sandbox Code Playgroud)

我得到的错误是:

 Expected value to be (using ===):
      "8:00"
    Received:
      undefined
    
    Difference:
    
      Comparing two …
Run Code Online (Sandbox Code Playgroud)

reactjs jestjs

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

Maven没有运行JUnit 5测试

我试图用maven运行一个简单的junit测试,但它没有检测到任何测试.我哪里错了?项目目录

Project -> src -> test-> java -> MyTest.java
Run Code Online (Sandbox Code Playgroud)

结果:

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
Run Code Online (Sandbox Code Playgroud)

的pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.buildproftest.ecs</groupId>
    <artifactId>buildprofiletest</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>5.3.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <debug>false</debug>
                    <optimize>true</optimize>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
Run Code Online (Sandbox Code Playgroud)

Junit测试用例

import org.junit.jupiter.api.Test;

public class MyTest {
    @Test
    public void printTest() {
        System.out.println("Running JUNIT …
Run Code Online (Sandbox Code Playgroud)

junit maven maven-surefire-plugin junit5

6
推荐指数
3
解决办法
2879
查看次数

使用户电子邮件唯一django

当用户注册时,如何使Django用户电子邮件唯一?

表格

class SignUpForm(UserCreationForm):
    email = forms.EmailField(required=True)

    class Meta:
        model = User
        fields = ("username", "email", "password1", "password2")

    def save(self, commit=True):
        user = super(SignUpForm, self).save(commit=False)
        user.email = self.cleaned_data["email"]
        if commit:
            user.save()
        return user
Run Code Online (Sandbox Code Playgroud)

我正在使用django.contrib.auth.models用户。我是否需要在模型中覆盖用户。当前,该模型未引用用户。

views.py

class SignUp(generic.CreateView):
    form_class = SignUpForm
    success_url = reverse_lazy('login')
    template_name = 'signup.html'
Run Code Online (Sandbox Code Playgroud)

感谢您的想法。

django

3
推荐指数
3
解决办法
2369
查看次数

Mock react-dom Jest

我试图用Jest模拟react-dom模块

import React from 'react';
import {configure, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import Link from '../components/DumbComp';
import { shallowToJson } from 'enzyme-to-json';
import { render } from 'react-dom';

configure({ adapter: new Adapter() });

jest.mock('react-dom');
describe('Link',() =>{
it('should render correctly', ()=>{
expect(render).toHaveBeenCalledWith(
  <Link title="mockTitle" url="mockUrl" />, 'element-node'
);
expect(render).toHaveBeenCalledTimes(1);
});
});
Run Code Online (Sandbox Code Playgroud)

当我运行测试时,我收到以下错误:

Link › should render correctly

expect(jest.fn()).toHaveBeenCalledWith(expected)

Expected mock function to have been called with:
  [<Link title="mockTitle" url="mockUrl" />, "element-node"]
But it was not called.
Run Code Online (Sandbox Code Playgroud)

似乎当我模拟渲染方法时,它不返回任何东西.有关如何正确嘲笑它的任何想法.

我正在使用本教程: …

javascript mocking reactjs jestjs

2
推荐指数
1
解决办法
3395
查看次数

tesseract python 系统找不到指定的文件

我正在运行一个使用 Tesseract 的 python 测试框架。

当我运行使用 tesseract 的测试时,我收到以下错误:

WindowsError: [Error 2] The system cannot find the file specified

我设法查看日志并发现它在以下位置中断:

File "C:\Python27\lib\subprocess.py", line 212, in check_output
process = Popen(stdout=PIPE, *popenargs, **kwargs)
File "C:\Python27\lib\subprocess.py", line 390, in __init__
errread, errwrite)
File "C:\Python27\lib\subprocess.py", line 640, in _execute_child
startupinfo)
Run Code Online (Sandbox Code Playgroud)

子进程由框架中的非 python lib 命令调用

def process_frame_text(single_char=False):
    tess_list = ['tesseract', 'tmp/ocr_image.png', 'tmp/ocr_output']
    tess_list += ['-psm', '10'] if single_char else []
    check_output(tess_list, stderr=STDOUT)[:-1]
Run Code Online (Sandbox Code Playgroud)

我已在我的计算机上安装了 Windows Tesseract,路径为 C:\Program Files x86\Tesseract-OCR

感谢你的想法。

谢谢

python windows tesseract python-2.7

0
推荐指数
1
解决办法
2474
查看次数

如何解决拒绝访问的AWS S3文件?

我正在尝试让在heroku中运行的Django应用程序可以访问s3存储桶中的文件(CSS JS文件)。

我认为我已经正确配置了settings.py。

但是,当我尝试更改S3存储桶中的权限时,访问被拒绝。 访问被拒绝错误

我添加了cors和bucket策略,并将其设置为public。

最终,当我从heroku加载应用程序时,尝试访问静态文件时出现403错误。

铲斗政策:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AddPerm",
            "Effect": "Allow",
            "Principal": {
                "AWS": "*"
            },
            "Action": "s3:*",
            "Resource": "arn:aws:s3:::NameOfBucket/*"
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

CORs配置:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
    <AllowedOrigin>*</AllowedOrigin>
    <AllowedMethod>GET</AllowedMethod>
    <MaxAgeSeconds>3000</MaxAgeSeconds>
    <AllowedHeader>Authorization</AllowedHeader>
</CORSRule>
</CORSConfiguration>
Run Code Online (Sandbox Code Playgroud)

公共访问设置 我如何获得在s3存储桶中进行更改的权限?

django heroku amazon-s3 amazon-web-services

0
推荐指数
1
解决办法
1959
查看次数